Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

unique-id-generator

danielnieto17ISC1.0.1

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

unique, id, generate, generator, uid, uniqueid

readme

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.