normalize toUnicode, version bump

master^2^2
Muhammed Tanrikulu 3 years ago
parent a84e8615f7
commit 6d4af7e2a2

@ -23,7 +23,7 @@ function namehash (inputName) {
}
function normalize(name) {
return name ? uts46.toAscii(name, {useStd3ASCII: true, transitional: false}) : name
return name ? uts46.toUnicode(name, {useStd3ASCII: true, transitional: false}) : name
}
module.exports = {

@ -1,6 +1,6 @@
{
"name": "@ensdomains/eth-ens-namehash",
"version": "2.0.14",
"version": "2.0.15",
"description": "A simple module for generating ENS namehashes per spec https://github.com/ethereum/EIPs/issues/137",
"main": "dist/index.js",
"scripts": {

@ -47,7 +47,15 @@ test('normalize ascii domain', (t) => {
test('normalize international domain', (t) => {
t.plan(1)
const input = 'fоо.eth' // with cyrillic 'o'
const expected = 'xn--f-1tba.eth'
const expected = 'fоо.eth'
const output = namehash.normalize(input)
t.equal(output, expected)
})
test('normalize capitalized domain', (t) => {
t.plan(1)
const input = 'Foo.eth' // latin chars only
const expected = 'foo.eth'
const output = namehash.normalize(input)
t.equal(output, expected)
})
@ -55,7 +63,7 @@ test('normalize international domain', (t) => {
test('normalize emoji domain', (t) => {
t.plan(1)
const input = '🦚.eth'
const expected = 'xn--qt9h.eth'
const expected = '🦚.eth'
const output = namehash.normalize(input)
t.equal(output, expected)
})

Loading…
Cancel
Save