@adraffy/ens-norm-uts46
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

ens-norm-uts46.js

  • Unicode 15.1.0 (but can be built using older versions)
  • Generates entire family of UTS-46 ToUnicode() functions
  • Passes 100% IDNATestV2
  • Supports Context{J,O}
  • Supports Punycode
  • ⚠️ Uses String.normalize() for NFC (if no implementation is provided)
  • ⚠️ Not space-efficient: ~185 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 = await 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
	nfc: cps => cps // number[] -> number[], leave unspecified for String.normalize()	
});

console.log(uts46('RAFFY.ETH'));

Build

  • git clone this repo then npm install
  • npm run derive — download and parse Unicode data files
  • npm run test — validate against IDNATestV2
  • npm run build — create /dist/

Readme

Keywords

Package Sidebar

Install

npm i @adraffy/ens-norm-uts46

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

867 kB

Total Files

7

Last publish

Collaborators

  • adraffy