Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

seq-index

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seq-index

Generate sequential indexes

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
151
decreased by-12.21%
Maintainers
1
Weekly downloads
 
Created
Source

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 = require('seq-index');
var indexer = new SeqIndex();

get()

Generate a sequential ID using get()

var id = indexer.get();
// 15654036c1709f68f2

short()

Generate a sequential ID without instance suffix using short()

var shortId = indexer.short();
// 15654036c1709f

getByTime()

Use to convert a timestamp into a short ID for comparison

var shortId = indexer.getByTime(1470300906242, 0);
// 15654c36302000
var id = shortId + indexer.suffix;
// 15654c3630200068f2

License

MIT

Keywords

FAQs

Package last updated on 04 Aug 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc