Add unicode tests

This commit is contained in:
Matt committed 2020-08-19 10:55:29 +01:00
1 parent 13a54ec318
commit 3ab95384df
5 files changed
+87 -27

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ class RemoveDiacritics extends Operation {
this.name = "Remove Diacritics";
this.module = "Default";
this.description = "Replaces accented characters with their latin character equivalent.";
this.description = "Replaces accented characters with their latin character equivalent. Accented characters are made up of Unicode combining characters, so unicode text formatting such as strikethroughs and underlines will also be removed.";
this.infoURL = "https://wikipedia.org/wiki/Diacritic";
this.inputType = "string";
this.outputType = "string";
+2 -3
View File
@@ -46,7 +46,6 @@ class UnicodeTextFormat extends Operation {
run(input, args) {
const [underline, strikethrough] = args;
let output = input.map(char => [char]);
console.dir(output);
if (strikethrough) {
output = output.map(charFormat => {
charFormat.push(...Utils.strToUtf8ByteArray("\u0336"));
@@ -59,8 +58,8 @@ class UnicodeTextFormat extends Operation {
return charFormat;
});
}
console.dir(output);
return output.flat();
// return output.flat(); - Not supported in Node 10, polyfilled
return [].concat(...output);
}
}