An open API service indexing awesome lists of open source software.

https://github.com/gavinning/unique-integer-id

数字ID,常用于生成订单号,流水单号
https://github.com/gavinning/unique-integer-id

Last synced: 5 months ago
JSON representation

数字ID,常用于生成订单号,流水单号

Awesome Lists containing this project

README

          

unique-integer-id
---
数字ID,常用于订单号,流水号等常见数字ID场景

### Install
```sh
npm i @4a/cid
```

### Usage
```js
const cid = require('@4a/cid')

// 默认长度26
cid() // 20072418073123028206226431
cid(36) // 200724180731230341096740207611144342
```

```js
cid(24) // 设置长度24 推荐QPS低于10万
cid(26) // 设置长度26 推荐QPS低于20万
```

### Prefix
```js
// 默认前缀取两位数年份
// 例如2021年,则前缀是21
// 同样可以自定义前缀,两位数

cid(26, { prefix: 10 })
```