@adraffy/ens-norm-uts46
v0.1.1
Published
ENS Name Normalization UTS46 Implementation
Downloads
12
Readme
ens-norm-uts46.js
- Unicode
16.0.0
(but can be built using any version) - Generates entire family of UTS-46
ToUnicode()
functions- Supports Bidi, Context{J,O}, and Punycode
- ✅️ Passes 100% IDNATestV2
- ⚠️ Uses
String.normalize()
for NFC (if no implementation is provided) - ⚠️ Not space-efficient:
~188 KB
minified
Example
import {create_uts46} from '@adraffy/ens-norm-uts46';
// npm i @adraffy/ens-norm-uts46
// browser: https://cdn.jsdelivr.net/npm/@adraffy/ens-norm-uts46@latest/dist/index.min.js
const uts46 = create_uts46({
version: 2003,
use_STD3: true,
valid_deviations: true, // deprecated in 15.1
check_hyphens: true,
check_bidi: true,
contextJ: true,
contextO: false,
check_leading_cm: true,
punycode: true, // uses @adraffy/punycode.js
nfc: cps => cps // number[] -> number[], leave unspecified for String.normalize()
});
console.log(uts46('RAFFY.ETH'));
Build
git clone
this repo thennpm install
npm run derive
— download and parse Unicode data files- Edit make.js to change Unicode version
- Creates include.js
npm run test
— validate against IDNATestV2npm run build
— create/dist/