UUID-js
A js library to generate and parse UUID's, TimeUUID's and generate empty TimeUUID's based on TimeStamp for range selections.
var UUID = require('uuid-js');
var uuid4 = UUID.create();
console.log( uuid4.toString() );
var uuid1 = UUID.create(1);
console.log( uuid1.toString() );
var today = new Date().getTime();
var last30days = (new Date().setDate( today.getDate() - 30 )).getTime();
var rangeStart = UUID.firstUUIDForTime( last30days );
var rangeEnd = UUID.lastUUIDForTime( today );
var query = ...( "select first 50 reversed ?..? from user_twits where key=?", [ rangeStart, rangeEnd, "patricknegri" ]);
Instalation
$ npm install uuid-js
Functions List
These are available just with require and return an instance of the UUID object:
UUID.create(4);
UUID.create(1);
UUID.fromTime( time, last );
UUID.firstUUIDForTime( time );
UUID.lastUUIDForTime( time );
UUID.fromURN( strId );
UUID.fromBytes( ints );
UUID.fromBinary( binary );
Methods List
These must be called on an instance of the UUID object:
aUUID.fromParts( timeLow, timeMid, timeHiAndVersion, clockSeqHiAndReserved, clockSeqLow, node );
aUUID.toString();
aUUID.toURN();
aUUID.toBytes();
Tests
make test
Contributors
This work was based RFC and by the work of these people.