1.0.0 • Published 8 years ago
@byted/id-generator v1.0.0
ID Generator
An uncentralized id generator based on mac address, process id, timestamp and random numbers.
INSTALLATION
npm install --save @byted/id-generatorUSAGE
const IDGenerator = require('@byted/id-generator');
const generator = new IDGenerator(options);
const id = generator.generate();options
prefix: prefix of id string, default to'';radix: an integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of id, default to10;hash:trueorfalse, return hased id if true, default tofalse.
EXAMPLE
const IDGenerator = require('@byted/id-generator');
const generator = new IDGenerator({
prefix: '',
radix: 36,
hash: false
});
const id = generator.generate();1.0.0
8 years ago