7 Commits
1.0.4 ... 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
Vitaly Puzrin
af3e0a9b7c 1.0.5 released 2020-03-03 05:02:17 +03:00
Vitaly Puzrin
7ff0277276 Merge pull request #6 from turt2live/patch-1
Ship the TypeScript declarations too
2020-03-03 04:59:09 +03:00
Travis Ralston
d6ec78e7c1 Ship the TypeScript declarations too
TypeScript declarations were added, but unfortunately they didn't get put into the release because they weren't listed as a file.
2020-03-02 18:19:17 -07:00
6 changed files with 50 additions and 9 deletions

View File

@@ -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
------------------

View File

@@ -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

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",
@@ -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",
"": "l",
"": "l",
@@ -2080,6 +2094,7 @@
"𝟢": "O",
"𝟬": "O",
"𝟶": "O",
"🯰": "O",
"": "O",
"𝐎": "O",
"𝑂": "O",
@@ -5444,7 +5459,6 @@
"脧": "朘",
"望": "望",
"望": "望",
"朡": "朡",
"幐": "㬺",
"䐠": "㬻",
"𣎓": "𣎓",
@@ -5869,6 +5883,7 @@
"脃": "脃",
"脾": "脾",
"䐋": "䐋",
"朡": "朡",
"𦞧": "𦞧",
"𦞵": "𦞵",
"朦": "䑃",

View File

@@ -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"
}
}

View File

@@ -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'], ' ');
});
});

View File

@@ -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!');
}