Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

unique-lexicographic-integer

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    unique-lexicographic-integer

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


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Install size
55.3 kB
Created
Weekly downloads
 

Readme

Source

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])

  • options.separator (string): defaults to '.'
  • options.strict (boolean): opt-in to type-checking input. Handled by lexicographic-integer-encoding. If true, encode will throw:
    • A TypeError if input is not a number or if NaN
    • A RangeError if input is < 0 or > Number.MAX_SAFE_INTEGER.

see also

install

With npm do:

npm install unique-lexicographic-integer

license

MIT © Vincent Weevers

Keywords

FAQs

Last updated on 24 Oct 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc