sole-token
v1.1.1
Published
A unique token generator NPM package!
Downloads
9
Readme
A unique token generator NPM package!
📦 Install with the help of npm or yarn
npm install sole-token
# or
yarn add sole-token
Usage
There is only one method in this package, and it supports four types of sub-methods and any character can be given as a delimiter.
Supported type
- uuid4 : a RFC UUID version-4 id.
- uuid1 : a RFC UUID version-1 id.
- token : a unique token value with the help of random number.
- id : a numeric unique token value with the help of random number.
const soleToken = require('sole-token');
console.log(soleToken({})); // default: { type: 'uuid4', delimiter: '-', size: 32 }
// Output => kDfKZe11-8073-0uER-SYDD-KPpXwaWdrehK
console.log(soleToken({ type: 'uuid1' }));
// Output => 1fcce411-e411-1fcc-28a0-00155d77aab6
console.log(soleToken({ type: 'token' }));
// Output => IMMcYU1058412nLqufqxN@PgtdcW@wKg
// If you adjust the size the type automatically become token, if they not a id type.
console.log(soleToken({ size: 5 }));
// Output => j~mDb
console.log(soleToken({ type: 'id', size: 5 }));
// Output => 45631