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
|
||||
------------------
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
> Replace all homoglyphs with base characters. Useful to detect similar strings.
|
||||
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,
|
||||
`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",
|
||||
@@ -921,6 +925,7 @@
|
||||
"𝟥": "3",
|
||||
"𝟯": "3",
|
||||
"𝟹": "3",
|
||||
"🯳": "3",
|
||||
"Ɜ": "3",
|
||||
"Ȝ": "3",
|
||||
"Ʒ": "3",
|
||||
@@ -947,6 +952,7 @@
|
||||
"𝟦": "4",
|
||||
"𝟰": "4",
|
||||
"𝟺": "4",
|
||||
"🯴": "4",
|
||||
"Ꮞ": "4",
|
||||
"𑢯": "4",
|
||||
"۴": "٤",
|
||||
@@ -963,6 +969,7 @@
|
||||
"𝟧": "5",
|
||||
"𝟱": "5",
|
||||
"𝟻": "5",
|
||||
"🯵": "5",
|
||||
"Ƽ": "5",
|
||||
"𑢻": "5",
|
||||
"⑤": "➄",
|
||||
@@ -976,6 +983,7 @@
|
||||
"𝟨": "6",
|
||||
"𝟲": "6",
|
||||
"𝟼": "6",
|
||||
"🯶": "6",
|
||||
"Ⳓ": "6",
|
||||
"б": "6",
|
||||
"Ꮾ": "6",
|
||||
@@ -994,6 +1002,7 @@
|
||||
"𝟩": "7",
|
||||
"𝟳": "7",
|
||||
"𝟽": "7",
|
||||
"🯷": "7",
|
||||
"𐓒": "7",
|
||||
"𑣆": "7",
|
||||
"⑦": "➆",
|
||||
@@ -1011,6 +1020,7 @@
|
||||
"𝟪": "8",
|
||||
"𝟴": "8",
|
||||
"𝟾": "8",
|
||||
"🯸": "8",
|
||||
"ȣ": "8",
|
||||
"Ȣ": "8",
|
||||
"𐌚": "8",
|
||||
@@ -1030,6 +1040,7 @@
|
||||
"𝟫": "9",
|
||||
"𝟵": "9",
|
||||
"𝟿": "9",
|
||||
"🯹": "9",
|
||||
"Ꝯ": "9",
|
||||
"Ⳋ": "9",
|
||||
"𑣌": "9",
|
||||
@@ -1240,6 +1251,7 @@
|
||||
"¢": "c̸",
|
||||
"ȼ": "c̸",
|
||||
"₡": "C⃫",
|
||||
"🅮": "C⃠",
|
||||
"ç": "c̦",
|
||||
"ҫ": "c̦",
|
||||
"Ç": "C̦",
|
||||
@@ -1247,6 +1259,7 @@
|
||||
"Ƈ": "C'",
|
||||
"℅": "c/o",
|
||||
"℆": "c/u",
|
||||
"🅭": "㏄\t⃝",
|
||||
"⋴": "ꞓ",
|
||||
"ɛ": "ꞓ",
|
||||
"ε": "ꞓ",
|
||||
@@ -1740,6 +1753,7 @@
|
||||
"𝟣": "l",
|
||||
"𝟭": "l",
|
||||
"𝟷": "l",
|
||||
"🯱": "l",
|
||||
"I": "l",
|
||||
"I": "l",
|
||||
"Ⅰ": "l",
|
||||
@@ -2080,6 +2094,7 @@
|
||||
"𝟢": "O",
|
||||
"𝟬": "O",
|
||||
"𝟶": "O",
|
||||
"🯰": "O",
|
||||
"O": "O",
|
||||
"𝐎": "O",
|
||||
"𝑂": "O",
|
||||
@@ -5444,7 +5459,6 @@
|
||||
"脧": "朘",
|
||||
"望": "望",
|
||||
"望": "望",
|
||||
"朡": "朡",
|
||||
"幐": "㬺",
|
||||
"䐠": "㬻",
|
||||
"𣎓": "𣎓",
|
||||
@@ -5869,6 +5883,7 @@
|
||||
"脃": "脃",
|
||||
"脾": "脾",
|
||||
"䐋": "䐋",
|
||||
"朡": "朡",
|
||||
"𦞧": "𦞧",
|
||||
"𦞵": "𦞵",
|
||||
"朦": "䑃",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "unhomoglyph",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.6",
|
||||
"description": "Replace all homoglyphs with base characters.",
|
||||
"keywords": [
|
||||
"homoglyph",
|
||||
@@ -10,7 +10,8 @@
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"index.js",
|
||||
"data.json"
|
||||
"data.json",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
@@ -18,7 +19,7 @@
|
||||
"update": "node update.js && npm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.6.0",
|
||||
"mocha": "^6.2.2"
|
||||
"eslint": "^7.0.0",
|
||||
"mocha": "^7.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
4
test.js
4
test.js
@@ -26,4 +26,8 @@ describe('unhomoglyph', function () {
|
||||
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;
|
||||
});
|
||||
|
||||
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!');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user