Comparing version 3.3.2 to 3.3.3
@@ -20,7 +20,5 @@ import { urlAlphabet } from './url-alphabet/index.js' | ||
customRandom(alphabet, size, random) | ||
let nanoid = (size = 21) => { | ||
let id = '' | ||
let bytes = crypto.getRandomValues(new Uint8Array(size)) | ||
while (size--) { | ||
let byte = bytes[size] & 63 | ||
let nanoid = (size = 21) => | ||
crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { | ||
byte &= 63 | ||
if (byte < 36) { | ||
@@ -30,10 +28,9 @@ id += byte.toString(36) | ||
id += (byte - 26).toString(36).toUpperCase() | ||
} else if (byte < 63) { | ||
} else if (byte > 62) { | ||
id += '-' | ||
} else { | ||
id += '_' | ||
} else { | ||
id += '-' | ||
} | ||
} | ||
return id | ||
} | ||
return id | ||
}, '') | ||
export { nanoid, customAlphabet, customRandom, urlAlphabet, random } |
@@ -1,1 +0,1 @@ | ||
export let nanoid=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let n=63&r[t];e+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return e}; | ||
export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); |
{ | ||
"name": "nanoid", | ||
"version": "3.3.2", | ||
"description": "A tiny (130 bytes), secure URL-friendly unique string ID generator", | ||
"version": "3.3.3", | ||
"description": "A tiny (116 bytes), secure URL-friendly unique string ID generator", | ||
"keywords": [ | ||
@@ -47,2 +47,8 @@ "uuid", | ||
}, | ||
"./non-secure/package.json": "./non-secure/package.json", | ||
"./non-secure": { | ||
"require": "./non-secure/index.cjs", | ||
"import": "./non-secure/index.js", | ||
"default": "./non-secure/index.js" | ||
}, | ||
"./url-alphabet/package.json": "./url-alphabet/package.json", | ||
@@ -53,10 +59,4 @@ "./url-alphabet": { | ||
"default": "./url-alphabet/index.js" | ||
}, | ||
"./non-secure/package.json": "./non-secure/package.json", | ||
"./non-secure": { | ||
"require": "./non-secure/index.cjs", | ||
"import": "./non-secure/index.js", | ||
"default": "./non-secure/index.js" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21579
589