@php-wasm/util
Advanced tools
Comparing version 0.6.1 to 0.6.2
18
index.js
@@ -196,2 +196,16 @@ // packages/php-wasm/util/src/lib/semaphore.ts | ||
// packages/php-wasm/util/src/lib/random-string.ts | ||
function randomString(length = 36, specialChars = "!@#$%^&*()_+=-[]/.,<>?") { | ||
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + specialChars; | ||
let result = ""; | ||
for (let i = length; i > 0; --i) | ||
result += chars[Math.floor(Math.random() * chars.length)]; | ||
return result; | ||
} | ||
// packages/php-wasm/util/src/lib/random-filename.ts | ||
function randomFilename() { | ||
return randomString(36, "-_"); | ||
} | ||
// packages/php-wasm/util/src/lib/php-vars.ts | ||
@@ -225,3 +239,5 @@ function phpVar(value) { | ||
phpVar, | ||
phpVars | ||
phpVars, | ||
randomFilename, | ||
randomString | ||
}; |
{ | ||
"name": "@php-wasm/util", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"type": "commonjs", | ||
@@ -15,3 +15,3 @@ "typedoc": { | ||
}, | ||
"gitHead": "171b22b853786b8912d9624ea064eaa1e985e96b", | ||
"gitHead": "3c0de0d0847c3550a75a026bef9724eac421afbf", | ||
"engines": { | ||
@@ -18,0 +18,0 @@ "node": ">=18.18.2", |
6295
236