nanoid 3.3.11 → 3.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +14 -0
- package/index.cjs +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(node /workspaces/nanoid/test/check-versions.js)",
|
|
5
|
+
"Bash(echo \"Exit: $?\")",
|
|
6
|
+
"Bash(node --version)",
|
|
7
|
+
"Bash(node --experimental-strip-types test/check-prebuild.js)",
|
|
8
|
+
"Bash(node --experimental-strip-types test/update-prebuild.js)",
|
|
9
|
+
"Bash(node test/check-versions.js)",
|
|
10
|
+
"Bash(node bin/nanoid.js --version)",
|
|
11
|
+
"Bash(node bin/nanoid.js -s 10)"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
package/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const POOL_SIZE_MULTIPLIER = 128
|
|
|
11
11
|
let pool, poolOffset
|
|
12
12
|
|
|
13
13
|
let fillPool = bytes => {
|
|
14
|
+
if (bytes < 0 || bytes > 1024) throw new RangeError('Wrong ID size')
|
|
14
15
|
if (!pool || pool.length < bytes) {
|
|
15
16
|
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
|
16
17
|
crypto.randomFillSync(pool)
|
package/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { urlAlphabet } from './url-alphabet/index.js'
|
|
|
3
3
|
const POOL_SIZE_MULTIPLIER = 128
|
|
4
4
|
let pool, poolOffset
|
|
5
5
|
let fillPool = bytes => {
|
|
6
|
+
if (bytes < 0 || bytes > 1024) throw new RangeError('Wrong ID size')
|
|
6
7
|
if (!pool || pool.length < bytes) {
|
|
7
8
|
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
|
8
9
|
crypto.randomFillSync(pool)
|