@php-wasm/util 0.6.0 → 0.6.2

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.
Files changed (2) hide show
  1. package/index.js +17 -1
  2. 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.0",
3
+ "version": "0.6.2",
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": "3f137306ec8e3b10ec0674a1fe69ee43349edb4a",
15
+ "gitHead": "3c0de0d0847c3550a75a026bef9724eac421afbf",
16
16
  "engines": {
17
17
  "node": ">=18.18.2",
18
18
  "npm": ">=8.11.0"