generate short Parse ID for product, order...
Homepage Repository npm Download
npm install @tranduchieu/short-parse-id@0.0.4
npm install @tranduchieu/short-parse-id
import ShortParseId from '@tranduchieu/short-parse-id';
const ShortId = new ShortParseId(
ID_LENGTH, // default is 6
APP_ID,
SERVER_URL,
);
ShortId.batchAdd(5)
.then(console.log)
.catch(console.error);
ShortId.getOne
.then(console.log)
.catch(console.error);
Output: JFH-8C8
ShortId.status()
.then(console.log)
.catch(console.error);
Output:
{
available: 12,
used: 78
}
npm test
In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.