ens-normalize.js
0-dependancy Ethereum Name Service (ENS) Name Normalizer.
import {ens_normalize} from '@adraffy/ens-normalize';
let normalized = ens_normalize('RaFFY🚴♂️.eTh');
Format names with fully-qualified emoji:
let pretty = ens_beautify('1⃣2⃣.eth');
Normalize name fragments for substring search:
let frag1 = ens_normalize_fragment('AB--');
let frag2 = ens_normalize_fragment('\u{303}');
let frag3 = ens_normalize_fragment('οо');
Input-based tokenization:
let tokens = ens_tokenize('_R💩\u{FE0F}a\u{FE0F}\u{304}\u{AD}./');
Output-based tokenization:
let labels = ens_split('💩Raffy.eth_');
Generate a sorted array of (beautified) supported emoji codepoints:
let emojis = ens_emoji();
Determine if a character shouldn't be printed directly:
should_escape(0x202E);
Determine if a character is a combining mark:
is_combining_mark(0x20E3);
Format codepoints as print-safe string:
safe_str_from_cps([0x300, 0, 32, 97]);
safe_str_from_cps(Array(100).fill(97), 4);
Build
git clone
this repo, then npm install
- Follow instructions in /derive/ to generate data files
npm run make
— compress data files from /derive/output/
- Follow instructions in /validate/ to generate validation tests
npm run test
— perform validation testsnpm run build
— create /dist/npm run rebuild
— run all the commands abovenpm run order
— create optimal group ordering and rebuild again
Publishing to NPM
This project uses .js
instead of .mjs
so package.json uses type: module
. To avoid bundling issues, type
is dropped during packing. pre/post
hooks aren't used because they're buggy.
npm run pack
instead of npm pack
npm run pub
instead of npm publish
Security