Home

Awesome

unique-lexicographic-integer

lexicographic-integer plus a suffix if input is the same as the last call. Hex-encoded.

npm status node Travis build status AppVeyor build status JavaScript Style Guide Dependency status

example

const uli = require('unique-lexicographic-integer')
const encode = uli()

console.log(encode(0)) // '00'
console.log(encode(0)) // '00.01'
console.log(encode(1)) // '01'
console.log(encode(300)) // 'fb31'
console.log(encode(300)) // 'fb31.01'
console.log(encode(300)) // 'fb31.02'

const strict = uli({ strict: true })

try {
  strict('1')
} catch (err) {
  console.log(err.message) // 'Argument must be a valid number'
}

api

encode = require('unique-lexicographic-integer')([options])

see also

install

With npm do:

npm install unique-lexicographic-integer

license

MIT © Vincent Weevers