0.0.3 • Published 6 years ago

u-uuid-js v0.0.3

Weekly downloads
15
License
DO_WHATEVER_YOU_W...
Repository
github
Last release
6 years ago

u-uuid-js

A 'micro' GUID/UUID implementation based on RFC 4122.

Version Build Status License

Prerequisites

  • NodeJs / NPM

Installation

  npm i --save 'u-uuid-js'

Testing

From your application code.

  const uUUID = require('u-uuid-js')
  const myThing.id = uUUID.createV1([options [, buffer [, offset]]])

  console.log('myUUID --> ', myUUID)

Usage / API

This repo is under development. Initial LTS release will be 1.0.0, and it should not be used until then. That said...

uUUID.createV1([options [, buffer , offset]])

Generate and return an RFC4122 v1 (time-based) UUID.

  • options - (Object) Optional:
    • node - (Array) Node id; 6 bytes
    • clockseq - (Number 0 - 0x3fff) RFC clock sequence
    • msecs - (Number | Date) Time in milliseconds since unix Epoch
    • nsecs - (Number 0 - 9999) additional time, in 100-nanosecond units
  • buffer - (Array | Buffer) Array or Buffer where UUID bytes are to be written
  • offset - (Number) Buffer index at which to begin writing

Returns UUID string (|| buffer if specified)

Example: Generate string UUID with fully-specified options JavaScript

uuid.v1({
  node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
  clockseq: 0x1234,
  msecs: new Date('2011-11-01').getTime(),
  nsecs: 5678
})

Contributing

Not currently accepting outside contributors, but feel free to clone, modify and use as you wish.

Authors

License

This project is licensed under the DO_WHATEVER_YOU_WANT License - see the LICENSE file for details

Acknowledgments

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago