updated to add morre homoglyphs + use english chars only

This commit is contained in:
TateB
2021-11-29 13:40:18 +11:00
parent 7a61c5e20e
commit 0f14f53ec4
3 changed files with 266 additions and 106 deletions

View File

@@ -14,7 +14,7 @@ function replace_fn(match) {
}
function unhomoglyph(str) {
return str.replace(REPLACE_RE, replace_fn);
return str.toLowerCase().normalize('NFD').replace(/\p{Diacritic}/gu, "").replace(/[\u200B-\u200D\uFEFF\u034F]/g, '').replace(REPLACE_RE, replace_fn).toLowerCase();
}
module.exports = unhomoglyph;