zwj-name-converter
v1.2.0
Published
Convert any String to Unicode (and back), respecting the Zero Width Joiner (ZWJ) character.
Downloads
132
Maintainers
Readme
zwj-name-converter
Convert any string to Unicode or ASCII, respecting the Zero Width Joiner (ZWJ) character. zwj-name-converter was especially designed to be fully compatible with the Handshake protocol but is not limited to that. The zwj-name-converter is currently implemented on https://niami.io/.
It is compatible with Unicode Version 14.0.
Installation
Via npm:
npm install zwj-name-converter
In Node.js:
const converter = require("zwj-name-converter");
// To Unicode
converter.nameToUnicode("xn--vi8h"); // 🍕
converter.nameToUnicode("xn--nn8hi4bz4d"); // 🧑🏼🚀
converter.nameToUnicode("👨🏾❤👨🏽"); // 👨🏾❤👨🏽
// To ASCII
converter.nameToAscii("🍕"); // xn--vi8h
converter.nameToAscii("&/#, +()$~%.AL IC E-bob"); // alice-bob
converter.nameToAscii("xn--vi8h文教材"); // xn--xn--vi8h-5x3qlog6n
Test
npm test
License
zwj-name-converter is available under the MIT license.