Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unhomoglyph

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unhomoglyph

Replace all homoglyphs with base characters.

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Keywords

FAQs

Package last updated on 18 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc