mirror of
https://github.com/litruv/unhomoglyph.git
synced 2026-07-27 04:06:17 +10:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a61c5e20e | ||
|
|
87c8f30f3e | ||
|
|
9d6bc548cd | ||
|
|
193738762a | ||
|
|
af3e0a9b7c | ||
|
|
7ff0277276 | ||
|
|
d6ec78e7c1 |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
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
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Include missed TS definition into npm package.
|
||||||
|
|
||||||
|
|
||||||
1.0.4 / 2020-02-05
|
1.0.4 / 2020-02-05
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
21
data.json
21
data.json
@@ -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",
|
||||||
"I": "l",
|
"I": "l",
|
||||||
"Ⅰ": "l",
|
"Ⅰ": "l",
|
||||||
@@ -2080,6 +2094,7 @@
|
|||||||
"𝟢": "O",
|
"𝟢": "O",
|
||||||
"𝟬": "O",
|
"𝟬": "O",
|
||||||
"𝟶": "O",
|
"𝟶": "O",
|
||||||
|
"🯰": "O",
|
||||||
"O": "O",
|
"O": "O",
|
||||||
"𝐎": "O",
|
"𝐎": "O",
|
||||||
"𝑂": "O",
|
"𝑂": "O",
|
||||||
@@ -5444,7 +5459,6 @@
|
|||||||
"脧": "朘",
|
"脧": "朘",
|
||||||
"望": "望",
|
"望": "望",
|
||||||
"望": "望",
|
"望": "望",
|
||||||
"朡": "朡",
|
|
||||||
"幐": "㬺",
|
"幐": "㬺",
|
||||||
"䐠": "㬻",
|
"䐠": "㬻",
|
||||||
"𣎓": "𣎓",
|
"𣎓": "𣎓",
|
||||||
@@ -5869,6 +5883,7 @@
|
|||||||
"脃": "脃",
|
"脃": "脃",
|
||||||
"脾": "脾",
|
"脾": "脾",
|
||||||
"䐋": "䐋",
|
"䐋": "䐋",
|
||||||
|
"朡": "朡",
|
||||||
"𦞧": "𦞧",
|
"𦞧": "𦞧",
|
||||||
"𦞵": "𦞵",
|
"𦞵": "𦞵",
|
||||||
"朦": "䑃",
|
"朦": "䑃",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "unhomoglyph",
|
"name": "unhomoglyph",
|
||||||
"version": "1.0.4",
|
"version": "1.0.6",
|
||||||
"description": "Replace all homoglyphs with base characters.",
|
"description": "Replace all homoglyphs with base characters.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"homoglyph",
|
"homoglyph",
|
||||||
@@ -10,7 +10,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
"data.json"
|
"data.json",
|
||||||
|
"index.d.ts"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
@@ -18,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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
4
test.js
4
test.js
@@ -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'], ' ');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user