
21

confusables - npm
source link: https://www.npmjs.com/package/confusables
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Confusables
This library allows you to easily remove confusables from a string, into normal english characters.
Try it out: https://confusables.netlify.com/
Installation
yarn add confusables
npm install confusables
Usage
Removing confusables
const { remove } = require('confusables');
import remove from 'confusables'; // with ES modules
remove('Ἢἕļľᦞ ш٥ṟlᑰ! Hello World!'); // => Hello World! Hello World!
remove('Iлtèrnåtïonɑlíƶatïǫԉ'); // => Internationalization
Injecting random confusables
const { obfuscate } = require('confusables');
import { obfuscate } from 'confusables'; // with ES modules
obfuscate('Hello World!'); // => Ḣé?ŀ? Ꮤᴑ?łᏧ
obfuscate('Internationalization'); // => ᶦṅᵗᧉ??ȧťί?ቢค?ἱƶ?ナἰøʼn
List of supported confusable characters
const { characters } = require('confusables');
import { characters } from 'confusables'; // with ES modules
console.log(characters);
What are confusables?
Confusable characters are those that may be confused with others (in some common UI fonts), such as the Latin letter "o" and the Greek letter omicron "ο". Fonts make a difference: for example, the Hebrew character "ס" looks confusingly similar to "o" in some fonts (such as Arial Hebrew), but not in others.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK