npm.io
0.0.6 • Published 7 years ago

normalize-hex

Licence
MIT
Version
0.0.6
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
6

normalize-hex

Normalize a hex string

License NPM version

Install

npm install normalize-hex

Getting started

const normalizeHex = require('normalize-hex')

console.log(normalizeHex('abc')) // 'abc'
console.log(normalizeHex('abc', { evenLength: true })) // '0abc'
console.log(normalizeHex('abc', { addPrefix: true })) // '0xabc'
console.log(normalizeHex('abc', { evenLength: true, addPrefix: true })) // '0x0abc'
console.log(normalizeHex('0xabc')) // 'abc'
console.log(normalizeHex('')) // '0'
console.log(normalizeHex('', { evenLength: true, addPrefix: true })) // '0x00'

Test

npm test

License

MIT

Keywords