Detalhes do pacote

unhomoglyph

nodeca159.8kMIT1.0.6

Replace all homoglyphs with base characters.

homoglyph, homoglyphs

readme (leia-me)

unhomoglyph

Build Status NPM version

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, 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 transform, to check if sources looks similar or not. If sources look similar, then transformed strings are equal.

Install

npm install unhomoglyph --save

Example

const unhomoglyph = require('unhomoglyph');

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`);
}

Update

npm run update

License

MIT

changelog (log de mudanças)

1.0.6 / 2020-05-18

1.0.5 / 2020-03-03

  • Include missed TS definition into npm package.

1.0.4 / 2020-02-05

  • Added TS definition.

1.0.3 / 2019-11-04

1.0.2 / 2017-03-05

1.0.1 / 2016-12-09

  • Fix repo link.

1.0.0 / 2016-12-09

  • First release.