unique-id-generator

1.0.1 • Public • Published

unique-id-generator

Utility to generate unique ID based on Date.now()

Why?

This function is meant to return an unique ID using the value of Date.now(), it ensures that the IDs are unique (from all other IDs generated by an instances of this module)

How to use it?

1.- Install it in your project:

npm install unique-id-generator -S

2.- Require it:

var generateID = require("unique-id-generator");

3.- Use it:

var id = generateID({prefix:"id-"});
//generates something like id-1476734792457

4.- Profit.

API

uniqueIdGenerator([options])

options

prefix

Type: String

Adds specified prefix at the beginning of the generated ID.

suffix

Type: String

Adds specified suffix at the end of the generated ID.

Package Sidebar

Install

npm i unique-id-generator

Weekly Downloads

9

Version

1.0.1

License

ISC

Last publish

Collaborators

  • danielnieto