@php-wasm/util 0.6.1 → 0.6.3
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/index.js +17 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -193,6 +193,20 @@ var ChildProcess = class extends EventEmitter {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
+
// packages/php-wasm/util/src/lib/random-string.ts
|
|
197
|
+
function randomString(length = 36, specialChars = "!@#$%^&*()_+=-[]/.,<>?") {
|
|
198
|
+
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + specialChars;
|
|
199
|
+
let result = "";
|
|
200
|
+
for (let i = length; i > 0; --i)
|
|
201
|
+
result += chars[Math.floor(Math.random() * chars.length)];
|
|
202
|
+
return result;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// packages/php-wasm/util/src/lib/random-filename.ts
|
|
206
|
+
function randomFilename() {
|
|
207
|
+
return randomString(36, "-_");
|
|
208
|
+
}
|
|
209
|
+
|
|
196
210
|
// packages/php-wasm/util/src/lib/php-vars.ts
|
|
197
211
|
function phpVar(value) {
|
|
198
212
|
return `json_decode(base64_decode('${stringToBase64(
|
|
@@ -221,5 +235,7 @@ export {
|
|
|
221
235
|
joinPaths,
|
|
222
236
|
normalizePath,
|
|
223
237
|
phpVar,
|
|
224
|
-
phpVars
|
|
238
|
+
phpVars,
|
|
239
|
+
randomFilename,
|
|
240
|
+
randomString
|
|
225
241
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/util",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"typedoc": {
|
|
6
6
|
"entryPoint": "./src/index.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"access": "public",
|
|
13
13
|
"directory": "../../../dist/packages/php-wasm/util"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "0a8916ec08aa5f02de5fea308b287171e7948e4b",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">=18.18.2",
|
|
18
18
|
"npm": ">=8.11.0"
|