Urara-Blog/node_modules/.pnpm-store/v3/files/70/d7b44d844f1d3626f02c473a2f6bb0b49bfb228d55dc1424e775baadf45c58648e12d07e1f860804667a36b1e1f98e4b0fd1afa0d16f37d09d83bc1962508d
2022-08-14 01:14:53 +08:00

21 lines
499 B
Text

let urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
let customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = ''
let i = size
while (i--) {
id += alphabet[(Math.random() * alphabet.length) | 0]
}
return id
}
}
let nanoid = (size = 21) => {
let id = ''
let i = size
while (i--) {
id += urlAlphabet[(Math.random() * 64) | 0]
}
return id
}
module.exports = { nanoid, customAlphabet }