# cf-gen-id

> Uniq your id

Latest version **3.1.1** (published 2022-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install cf-gen-id
pnpm add cf-gen-id
yarn add cf-gen-id
bun add cf-gen-id
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2022-04-06 |
| First published | 2021-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ClassFunc |
| Maintainers | thanh_classfunc |
| Keywords | random, id, gen id, nanoid, classfunc |

## Links

- npm: https://www.npmjs.com/package/cf-gen-id
- Repository: https://github.com/zerolethanh/cf-gen-id
- Homepage: https://github.com/zerolethanh/cf-gen-id#readme
- Issues: https://github.com/zerolethanh/cf-gen-id/issues
- npm.io page: https://npm.io/package/cf-gen-id

## Dependencies (1)

- [nanoid](https://npm.io/package/nanoid.md) ^3.3.2

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.1.1 (latest) — 2022-04-06
- 3.1.0 — 2022-04-01
- 3.0.9 — 2022-03-31
- 3.0.8 — 2022-03-31
- 3.0.7 — 2022-03-12
- 3.0.6 — 2022-03-12
- 3.0.5 — 2022-03-11
- 3.0.4 — 2022-03-11
- 3.0.3 — 2022-03-10
- 3.0.2 — 2022-03-10
- 3.0.1 — 2022-03-10
- 3.0.0 — 2022-03-10
- 2.1.1 — 2022-03-09
- 2.1.0 — 2022-03-05
- 2.0.0 — 2022-03-05
- … 6 more at https://npm.io/package/cf-gen-id/versions

## README

# Generate your_UniqId;

//user_4yIvo

> For v1 & v2, [Read Here](README-v1.md)

## Install:

```shell
yarn add cf-gen-id
or
npm i -S cf-gen-id
```

## Usage:

```js
import {
  genDateId,
  genDateIdPrefix,
  genId,
  genIdPrefix,
  genIdSize,
} from 'cf-gen-id';

const log = (func) => {
  for (let i = 0; i < 5; ++i) {
    console.log(func());
  }
};

log(() => genId());//yB364
log(() => genId({prefix: 'data_', size: 8}));//data_ArPxpi85
log(() => genIdPrefix('id_', {size: 12}));//id_4jfMDSSMLTz6
log(() => genDateIdPrefix('user_'));//user_220401T051921_NB0a2
log(() => genDateId({size: 10}));//220401T051921_jxWwNaQaUU
log(() => genIdSize(20));//SXXO75OG7Ds3mJ9L37q4

```

## API:

```ts
 interface IOptions {
    prefix?: string;
    date?: boolean;
    size?: number;
    randomSet?: string;
}
 const genId: (options?: IOptions | undefined) => string;
 const genIdPrefix: (prefix: string, options?: IOptions | undefined) => string;
 const genDateId: (options?: IOptions | undefined) => string;
 const genDateIdPrefix: (prefix: string, options?: IOptions | undefined) => string;
 const genIdSize: (size: number, options?: IOptions | undefined) => string;

```

Options:

`size`: default = 5 : Size of random string

`prefix`: default = '' : Prefix of random string

`date`: default = false : If true, prefix date format `YYMMDDTHHmmss_` before random string

`randomSet`: default = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`

## Author:

[ClassFunc Softwares JSC](https://classfunc.com)

## LICENSE:

MIT

---
_Source: https://npm.io/package/cf-gen-id · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
