Spaces:
Paused
Paused
Download node_modules/@reduxjs/toolkit/src/nanoid.ts from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 585 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40reduxjs/toolkit/src/nanoid.ts
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@reduxjs/toolkit/src/nanoid.ts
-
curl -L -o nanoid.ts https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40reduxjs/toolkit/src/nanoid.ts
585 Bytes
| // Borrowed from https://github.com/ai/nanoid/blob/3.0.2/non-secure/index.js | |
| // This alphabet uses `A-Za-z0-9_-` symbols. A genetic algorithm helped | |
| // optimize the gzip compression for this alphabet. | |
| let urlAlphabet = | |
| 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW' | |
| /** | |
| * | |
| * @public | |
| */ | |
| export let nanoid = (size = 21) => { | |
| let id = '' | |
| // A compact alternative for `for (var i = 0; i < step; i++)`. | |
| let i = size | |
| while (i--) { | |
| // `| 0` is more compact and faster than `Math.floor()`. | |
| id += urlAlphabet[(Math.random() * 64) | 0] | |
| } | |
| return id | |
| } | |