squuid

1.0.0 • Public • Published

squuid

Semi-sequential universally unique identifiers

build status

  // generate base64-lex-encoded v1 UUID
  var id = squuid() // 'Wjmi85Wy4UMVUHybSVnKU0--'
 
  // generate another
  var id2 = squuid() // 'Wjmi8LWy4UMVUHybSVnKU0--'
 
  // ids will be monotonically increasing per process
  id2 > id // true
 
  // you can pass 
  squuid({
    msecs: Date.now() + 100 // epoch time, defaults to `Date.now`
    // node: node id as array of 6 bytes (randomly generated if not provided)
    // clockseq: RFC clock sequence, number between 0 and 0x3fff
  })

TODO: node-uuid looks to be encoding the time bit in little-endian, which marginally decreases the monotonicity properties you want for optimal btree inserts.

Package Sidebar

Install

npm i squuid

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • deanlandolt