0.1.6 • Published 11 months ago
@aamirtech/utils v0.1.6
@aamirtech/utils
Library packed with your basic code utils.
Installation
Install with npm
npm install @aamirtech/utilsInstall with yarn
yarn add @aamirtech/utilsInstall with bun
bun add @aamirtech/utilsUsage
Simple Snowflake Generation
import { Id } from "@aamirtech/utils";
console.log(Snowflake.generate());
// 7167216930510602240Publid ID / OTP Generation
| Option | Type | Default | Description |
|---|---|---|---|
| length | number | 6 | Length of the public id |
| alphabetic | boolean | true | Include alphabets in the public id |
| numeric | boolean | true | Include numbers in the public id |
import { getPublicId } from "@aamirtech/utils";
// Mix of Alphabets and Numbers (default)
console.log(getPublicId(6));
// 7C43DU
// Alphabets only
console.log(getPublicId(6, { alphabetic: true }));
// FZPUWJ
// Numbers only
console.log(getPublicId(6, { numeric: true }));
// 252537Tests
Tests are written in Bun Test. To run tests, run the following command:
bun testTo run tests with coverage, run the following command:
bun test:coverage
```
## License
[MIT](https://choosealicense.com/licenses/mit/)
The project contains part based on a fork off of (snowflake-generator)[https://github.com/FatAussieFatBoy/snowflake-generator].