0.0.6 • Published 5 years ago

normalize-hex v0.0.6

Weekly downloads
5,945
License
MIT
Repository
github
Last release
5 years ago

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