normalize-hex
v0.0.6
Published
Normalize a hex string
Downloads
10,891
Readme
normalize-hex
Normalize a hex string
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