0.1.5 • Published 2 years ago

cakeid v0.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

1.如何安装cakeid

1.How to install cakeid

npm install cakeid
// 或/or
yarn add cakeid

2.如何使用cakeid

2.How to use cakeid

charset配置项写入任意大小写字母和数字即可

Charset configuration item can be written with any upper and lower case letters and numbers

import { definedCakeid } from 'cakeid'

const id = definedCakeid({ byte: 10, charset: 'aA0' })
console.log(id)	// 5oL2l1FIDM

const id_2 = definedCakeid({ byte: 10, charset: 'a0' })
console.log(id_2) // 418r77tp3i

const id_3 = definedCakeid({ byte: 10, charset: '0' })
console.log(id_3) // 7718071110

const id_4 = definedCakeid({ byte: 10, charset: '9a' })
console.log(id_4)// y2f4pj448t

3.配置项

3.options

配置/options类型/type备注/remarks
bytenumber生成了几个字节/How many bytes are generated
charsetstring字符集/character set

4.内置方法

4.Built in method

import { definedCakeid , cakeid } from 'cakeid'

// 直接生成由大小写字母和数字组成的字符串
// Directly generate a string composed of upper and lower case letters and numbers
// cakeid( number )
const id_1 = cakeid(10)
console.log(id_1) // tkrIcBrBiL

// 根据配置项生成的随机字符串
// Random string generated from configuration item
// definedCakeid( { options } )
const id_2 = definedCakeid( { byte: 6, charset: 'A0'} ) 
console.log(id_2) // B3DDT4
0.1.2

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.1.5

2 years ago

0.1.0

2 years ago