Skip to content

0xStefan/zwj-name-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zwj-name-converter

Build Status

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("👨🏾❤👨🏽"); // 👨🏾‍❤‍👨🏽

// Unsupported or Invalid Punycode will not be converted
converter.nameToUnicode("xn--0"); // xn--0
converter.nameToUnicode("xn--v86c5408p"); // xn--v86c5408p
converter.nameToUnicode("xn--1ug5408p"); // xn--1ug5408p

// 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published