unique-values-generator
v1.2.0
Published
unique values generator
Downloads
7
Maintainers
Readme
unique-values-generator is a node package for generating unique numbers which still persists even if the server has lost connection or the server is off.
It truly generates unique numbers with an option to prefix the generated numbers with your own text
Guide to using the package in your project
In your project directory, run npm install unique-values-generator OR yarn add unique-values-generator
You can then require it in your file and use it const uniquevalues = require('unique-values-generator'); const value = uniquevalues.generate(1000,{increment:1,prefix:'Patient'});
console.log(value); # Patient1000, Patient1001, Patient1002, ...
Three way usage. You can choose any which suits your needs.
Usage 1 const uniquevalues = require('unique-values-generator'); #Example; let num = uniquevalues.generate(100) // returns series of unique number on every call
uniquevalues.generate(startValue); //startValue can be any number
Clear data from storage
const uniquevalues = require('unique-values-generator'); uniquevalues.clear();
Usage 2 const uniquevalues = require('unique-values-generator'); #Example; let num = uniquevalues.generate(100, 1) // returns series of unique number on every call.. 100, 101, 102...
uniquevalues.generate(startValue, increment);
Usage 3 (with optional parameters) const uniquevalues = require('unique-values-generator'); #Example let num = uniquevalues.generate(1000,{increment:1,prefix:'Patient'}); // Patient1000, Patient1001, Patient1002, ...
uniquevalues.generate(startValue, {increment, prefix});