4 Commits
1.0.5 ... 1.0.6

Author SHA1 Message Date
Vitaly Puzrin
7a61c5e20e 1.0.6 released 2020-05-18 08:06:29 +03:00
Vitaly Puzrin
87c8f30f3e dev deps bump 2020-05-18 08:04:21 +03:00
Vitaly Puzrin
9d6bc548cd Encode 2028 & 2029 chars in text form, close #7 2020-05-18 08:02:04 +03:00
Vitaly Puzrin
193738762a Mapping data update to v13.0.0 2020-05-18 07:30:45 +03:00
6 changed files with 42 additions and 8 deletions

View File

@@ -1,3 +1,12 @@
1.0.6 / 2020-05-18
------------------
- Update mapping data to version 13.0.0
http://www.unicode.org/Public/security/latest/confusables.txt
- Encode `\u2028` & `\u2029` as text, #7.
- Dev deps bump.
1.0.5 / 2020-03-03 1.0.5 / 2020-03-03
------------------ ------------------

View File

@@ -6,7 +6,7 @@
> Replace all homoglyphs with base characters. Useful to detect similar strings. > Replace all homoglyphs with base characters. Useful to detect similar strings.
For example, to prohibit register similar looking nicknames at websites. For example, to prohibit register similar looking nicknames at websites.
Data source - [Recommended confusable mapping for IDN](http://www.unicode.org/Public/security/latest/confusables.txt), v12.1.0. Data source - [Recommended confusable mapping for IDN](http://www.unicode.org/Public/security/latest/confusables.txt), v13.0.0.
__Note!__ Text after transform is NOT intended be read by humans. For example, __Note!__ Text after transform is NOT intended be read by humans. For example,
`m` will be transformed to `r` + `n`. Goal is to compare 2 strings after `m` will be transformed to `r` + `n`. Goal is to compare 2 strings after

View File

@@ -157,8 +157,8 @@
"໊": "๊", "໊": "๊",
"໋": "๋", "໋": "๋",
"꙯": "⃩", "꙯": "⃩",
"": " ", "\u2028": " ",
"": " ", "\u2029": " ",
"": " ", "": " ",
" ": " ", " ": " ",
"": " ", "": " ",
@@ -841,6 +841,8 @@
"𐆠": "⳨", "𐆠": "⳨",
"♩": "𝅘𝅥", "♩": "𝅘𝅥",
"♪": "𝅘𝅥𝅮", "♪": "𝅘𝅥𝅮",
"⓪": "🄍",
"↺": "🄎",
"˙": "ॱ", "˙": "ॱ",
"ൎ": "ॱ", "ൎ": "ॱ",
"": "ー", "": "ー",
@@ -863,6 +865,7 @@
"ᅴ": "ー丨", "ᅴ": "ー丨",
"ㅢ": "ー丨", "ㅢ": "ー丨",
"ᆗ": "ー丨ᅮ", "ᆗ": "ー丨ᅮ",
"🄏": "$⃠",
"₤": "£", "₤": "£",
"〒": "₸", "〒": "₸",
"〶": "₸", "〶": "₸",
@@ -879,6 +882,7 @@
"𝟤": "2", "𝟤": "2",
"𝟮": "2", "𝟮": "2",
"𝟸": "2", "𝟸": "2",
"🯲": "2",
"": "2", "": "2",
"Ƨ": "2", "Ƨ": "2",
"Ϩ": "2", "Ϩ": "2",
@@ -921,6 +925,7 @@
"𝟥": "3", "𝟥": "3",
"𝟯": "3", "𝟯": "3",
"𝟹": "3", "𝟹": "3",
"🯳": "3",
"": "3", "": "3",
"Ȝ": "3", "Ȝ": "3",
"Ʒ": "3", "Ʒ": "3",
@@ -947,6 +952,7 @@
"𝟦": "4", "𝟦": "4",
"𝟰": "4", "𝟰": "4",
"𝟺": "4", "𝟺": "4",
"🯴": "4",
"": "4", "": "4",
"𑢯": "4", "𑢯": "4",
"۴": "٤", "۴": "٤",
@@ -963,6 +969,7 @@
"𝟧": "5", "𝟧": "5",
"𝟱": "5", "𝟱": "5",
"𝟻": "5", "𝟻": "5",
"🯵": "5",
"Ƽ": "5", "Ƽ": "5",
"𑢻": "5", "𑢻": "5",
"⑤": "➄", "⑤": "➄",
@@ -976,6 +983,7 @@
"𝟨": "6", "𝟨": "6",
"𝟲": "6", "𝟲": "6",
"𝟼": "6", "𝟼": "6",
"🯶": "6",
"": "6", "": "6",
"б": "6", "б": "6",
"": "6", "": "6",
@@ -994,6 +1002,7 @@
"𝟩": "7", "𝟩": "7",
"𝟳": "7", "𝟳": "7",
"𝟽": "7", "𝟽": "7",
"🯷": "7",
"𐓒": "7", "𐓒": "7",
"𑣆": "7", "𑣆": "7",
"⑦": "➆", "⑦": "➆",
@@ -1011,6 +1020,7 @@
"𝟪": "8", "𝟪": "8",
"𝟴": "8", "𝟴": "8",
"𝟾": "8", "𝟾": "8",
"🯸": "8",
"ȣ": "8", "ȣ": "8",
"Ȣ": "8", "Ȣ": "8",
"𐌚": "8", "𐌚": "8",
@@ -1030,6 +1040,7 @@
"𝟫": "9", "𝟫": "9",
"𝟵": "9", "𝟵": "9",
"𝟿": "9", "𝟿": "9",
"🯹": "9",
"": "9", "": "9",
"": "9", "": "9",
"𑣌": "9", "𑣌": "9",
@@ -1240,6 +1251,7 @@
"¢": "c̸", "¢": "c̸",
"ȼ": "c̸", "ȼ": "c̸",
"₡": "C⃫", "₡": "C⃫",
"🅮": "C⃠",
"ç": "c̦", "ç": "c̦",
"ҫ": "c̦", "ҫ": "c̦",
"Ç": "C̦", "Ç": "C̦",
@@ -1247,6 +1259,7 @@
"Ƈ": "C'", "Ƈ": "C'",
"℅": "c/o", "℅": "c/o",
"℆": "c/u", "℆": "c/u",
"🅭": "㏄\t⃝",
"⋴": "ꞓ", "⋴": "ꞓ",
"ɛ": "ꞓ", "ɛ": "ꞓ",
"ε": "ꞓ", "ε": "ꞓ",
@@ -1740,6 +1753,7 @@
"𝟣": "l", "𝟣": "l",
"𝟭": "l", "𝟭": "l",
"𝟷": "l", "𝟷": "l",
"🯱": "l",
"I": "l", "I": "l",
"": "l", "": "l",
"": "l", "": "l",
@@ -2080,6 +2094,7 @@
"𝟢": "O", "𝟢": "O",
"𝟬": "O", "𝟬": "O",
"𝟶": "O", "𝟶": "O",
"🯰": "O",
"": "O", "": "O",
"𝐎": "O", "𝐎": "O",
"𝑂": "O", "𝑂": "O",
@@ -5444,7 +5459,6 @@
"脧": "朘", "脧": "朘",
"望": "望", "望": "望",
"望": "望", "望": "望",
"朡": "朡",
"幐": "㬺", "幐": "㬺",
"䐠": "㬻", "䐠": "㬻",
"𣎓": "𣎓", "𣎓": "𣎓",
@@ -5869,6 +5883,7 @@
"脃": "脃", "脃": "脃",
"脾": "脾", "脾": "脾",
"䐋": "䐋", "䐋": "䐋",
"朡": "朡",
"𦞧": "𦞧", "𦞧": "𦞧",
"𦞵": "𦞵", "𦞵": "𦞵",
"朦": "䑃", "朦": "䑃",

View File

@@ -1,6 +1,6 @@
{ {
"name": "unhomoglyph", "name": "unhomoglyph",
"version": "1.0.5", "version": "1.0.6",
"description": "Replace all homoglyphs with base characters.", "description": "Replace all homoglyphs with base characters.",
"keywords": [ "keywords": [
"homoglyph", "homoglyph",
@@ -19,7 +19,7 @@
"update": "node update.js && npm test" "update": "node update.js && npm test"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^6.6.0", "eslint": "^7.0.0",
"mocha": "^6.2.2" "mocha": "^7.1.2"
} }
} }

View File

@@ -26,4 +26,8 @@ describe('unhomoglyph', function () {
assert.strictEqual(unhomoglyph('1abcаа'), 'labcaa'); assert.strictEqual(unhomoglyph('1abcаа'), 'labcaa');
}); });
it('2028 & 2029 should be ok after replace in updater', function () {
assert.strictEqual(data['\u2028'], ' ');
assert.strictEqual(data['\u2029'], ' ');
});
}); });

View File

@@ -37,8 +37,14 @@ function save(str) {
result[src] = dst; result[src] = dst;
}); });
let output = JSON.stringify(result, null, ' ')
// Workaround for ES9 <=> ES10 inconsistency
// https://github.com/nodeca/unhomoglyph/issues/7
// https://github.com/facebook/hermes/issues/235#issuecomment-623606572
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
fs.writeFileSync(SAVE_PATH, JSON.stringify(result, null, ' ')); fs.writeFileSync(SAVE_PATH, output);
console.log('Done!'); console.log('Done!');
} }