Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nodeca/unhomoglyph
Replace all homoglyphs with base characters. Useful to detect similar strings.
https://github.com/nodeca/unhomoglyph
Last synced: 7 days ago
JSON representation
Replace all homoglyphs with base characters. Useful to detect similar strings.
- Host: GitHub
- URL: https://github.com/nodeca/unhomoglyph
- Owner: nodeca
- License: mit
- Created: 2016-12-09T07:10:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-18T05:06:56.000Z (over 4 years ago)
- Last Synced: 2024-04-14T04:22:27.199Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 37
- Watchers: 5
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs-cn - unhomoglyph - 规范化视觉上相似的unicode字符. (包 / 文本)
- awesome-nodejs - unhomoglyph - Normalize visually similar unicode characters. (Repository / Text/String)
- awesome-nodejs-cn - unhomoglyph - **star:39** 在视觉上规范化相似的unicode字符 (包 / 文本)
- awesome-nodejs - unhomoglyph - Normalize visually similar unicode characters. (Packages / Text)
- awesome-nodejs - unhomoglyph - Replace all homoglyphs with base characters. Useful to detect similar strings. - ★ 13 (Text)
- awesome-node - unhomoglyph - Normalize visually similar unicode characters. (Packages / Text)
- awesome-nodejs-cn - unhomoglyph - 规范化视觉上相似的unicode字符. (目录 / 文本处理)
README
# unhomoglyph
[![Build Status](https://img.shields.io/travis/nodeca/unhomoglyph/master.svg?style=flat)](https://travis-ci.org/nodeca/unhomoglyph)
[![NPM version](https://img.shields.io/npm/v/unhomoglyph.svg?style=flat)](https://www.npmjs.org/package/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), 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
```bash
npm install unhomoglyph --save
```## Example
```js
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
```bash
npm run update
```## License
[MIT](https://github.com/nodeca/unhomoglyph/blob/master/LICENSE)