unhomoglyph
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -1,4 +0,11 @@ | ||
1.0.1 / 2017-03-05 | ||
1.0.3 / 2019-11-04 | ||
------------------ | ||
- Update mapping data to version 12.1.0 | ||
http://www.unicode.org/Public/security/latest/confusables.txt | ||
- Dev deps bump. | ||
1.0.2 / 2017-03-05 | ||
------------------ | ||
- Update mapping data to version 9.0.0 | ||
@@ -5,0 +12,0 @@ http://www.unicode.org/Public/security/latest/confusables.txt |
{ | ||
"name": "unhomoglyph", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Replace all homoglyphs with base characters.", | ||
@@ -21,5 +21,5 @@ "keywords": [ | ||
"devDependencies": { | ||
"eslint": "^3.11.1", | ||
"mocha": "^3.2.0" | ||
"eslint": "^6.6.0", | ||
"mocha": "^6.2.2" | ||
} | ||
} |
@@ -7,6 +7,12 @@ # unhomoglyph | ||
> 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), v9.0.0. | ||
Data source - [Recommended confusable mapping for IDN](http://www.unicode.org/Public/security/latest/confusables.txt), v12.1.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 | ||
transform, to check if sources looks similar or not. If sources look similar, | ||
then transformed strings are equal. | ||
## Install | ||
@@ -25,2 +31,14 @@ | ||
console.log(unhomoglyph('AΑАᎪᗅᴀꓮ')); // => AAAAAAA | ||
console.log(unhomoglyph('m')); // => rn (r + n) | ||
// | ||
// Compare nicknames | ||
// | ||
const username1 = 'm'; | ||
const username2 = 'rn'; | ||
if (unhomoglyph(username1) === unhomoglyph(username2)) { | ||
console.log(`"${username1}" and "${username2} look similar`); | ||
} | ||
``` | ||
@@ -27,0 +45,0 @@ |
Sorry, the diff of this file is too big to display
105800
6310
55