0.1.5 • Published 2 years ago

nodecakeid v0.1.5

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

1.如何安装nodecakeid

1.How to install nodecakeid

npm install nodecakeid
// 或/or
yarn add nodecakeid

2.如何使用nodecakeid

2.How to use nodecakeid

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

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

const nodecakeid = require('nodecakeid')

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

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

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

const id_4 = nodecakeid.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

const nodecakeid = require('nodecakeid')

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

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

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago