1.0.3 • Published 5 years ago

simple-id-gen v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

simple-id-gen

Generates unique random number with specified length

Installation

Install using npm

$ npm install simple-id-gen --save

Usage

Sample code

//using node.js
const SimpleId = require('simple-id-gen');
//using ES6 imports
import SimpleId from 'simple-id-gen';

//creates new object instances
const gen = new SimpleId();

console.log(gen.create); //creates id with length 1

More

//first parameter is the length of id wanted
const gen = new SimpleId(5);
console.log(gen.create); //creates id with length 5

//second parameter is an array of id's to avoid collision with it
const gen = new SimpleId(3, [234, 567, 112]);
console.log(gen.create); //creates an id and avoids collision with 234, 567, 112

Multiple id without collision

sample

License

The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago