@aamirtech/utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

aamirtech

@aamirtech/utils

GitHub license Maintainer Downloads Npm package version

Library packed with your basic code utils.

Installation

Install with npm

  npm install @aamirtech/utils

Install with yarn

  yarn add @aamirtech/utils

Install with bun

  bun add @aamirtech/utils

Usage

Simple Snowflake Generation

import { Id } from "@aamirtech/utils";

console.log(Snowflake.generate());
// 7167216930510602240

Publid 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 }));
// 252537

Tests

Tests are written in Bun Test. To run tests, run the following command:

  bun test

To 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].

Package Sidebar

Install

npm i @aamirtech/utils

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

13.9 kB

Total Files

15

Last publish

Collaborators

  • aamirkhan