1.2.0 ⢠Published 2 years ago
zwj-name-converter v1.2.0
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.