123456789101112131415161718192021222324252627282930 |
- let urlAlphabet =
- 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW'
- let customAlphabet = (alphabet, size) => {
- return () => {
- 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
- }
- export { nanoid, customAlphabet }
|