nanoid
npm i nanoid nanoid-dictionary
import { nanoid } from 'nanoid'
model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT"
// top level await
await nanoid()
// 10 bits
nanoid(10) //=> "IRFa-VaY2b"
// performance
import { nanoid } from 'nanoid/non-secure'
const id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqLJ"
// 自定义字符
import { customAlphabet } from 'nanoid'
const nanoid = customAlphabet('1234567890abcdef', 10)
model.id = nanoid() //=> "4f90d13a42"
// nanoid dictionary
import { customAlphabet } from 'nanoid';
import { lowercase } from 'nanoid-dictionary';
const lowercaseRandomString = customAlphabet(lowercase, 10);