seq-index
Generate sequential ID values. The generated value is a 18-byte hex string. The value consists of current timestamp, an incrementing counter and the instance id.
Install
Install from npm
npm install seq-index
Usage
Create SeqIndex
instance
var SeqIndex = ;var indexer = ;
get()
Generate a sequential ID using get()
var id = indexer;// 15654036c1709f68f2
short()
Generate a sequential ID without instance suffix using short()
var shortId = indexer;// 15654036c1709f
getByTime()
Use to convert a timestamp into a short ID for comparison
var shortId = indexer;// 15654c36302000var id = shortId + indexersuffix;// 15654c3630200068f2
License
MIT