@creejs/commons-lang 2.1.28 → 2.1.30
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/dist/cjs/index-dev.cjs +31 -2
- package/dist/cjs/index-dev.cjs.map +1 -1
- package/dist/cjs/index-min.cjs +1 -1
- package/dist/cjs/index-min.cjs.map +1 -1
- package/dist/esm/index-dev.js +31 -2
- package/dist/esm/index-dev.js.map +1 -1
- package/dist/esm/index-min.js +1 -1
- package/dist/esm/index-min.js.map +1 -1
- package/dist/umd/index.dev.js +31 -2
- package/dist/umd/index.dev.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
- package/types/_error.d.ts +20 -0
- package/types/array-buffer-utils.d.ts +3 -3
- package/types/promise-utils.d.ts +3 -0
package/dist/esm/index-dev.js
CHANGED
|
@@ -32,6 +32,32 @@ class _Error extends Error {
|
|
|
32
32
|
return err._type === '_' && typeof err.code === 'number'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param {string} message
|
|
38
|
+
* @param {number} time ms
|
|
39
|
+
* @returns {_Error}
|
|
40
|
+
*/
|
|
41
|
+
static timeout (message, time) {
|
|
42
|
+
return new _Error(`Timeout ${time}ms: ${message}`, 504)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* "412 Precondition Failed" indicates that one or more conditions
|
|
47
|
+
* given in the request header fields evaluated to false when tested on the server.
|
|
48
|
+
* * Header Purpose
|
|
49
|
+
* * If-Match Only proceed if the resource's ETag matches the given value
|
|
50
|
+
* * If-None-Match Only proceed if the resource's ETag doesn't match the given value
|
|
51
|
+
* * If-Modified-Since Only proceed if the resource was modified after the given date
|
|
52
|
+
* * If-Unmodified-Since Only proceed if the resource wasn't modified after the given date
|
|
53
|
+
|
|
54
|
+
* @param {string} message
|
|
55
|
+
* @returns {_Error}
|
|
56
|
+
*/
|
|
57
|
+
static preconditionFailed (message) {
|
|
58
|
+
return new _Error(`Not Matched: ${message}`, 412)
|
|
59
|
+
}
|
|
60
|
+
|
|
35
61
|
/**
|
|
36
62
|
* Creates and returns a 404 Not Found error instance with the given message.
|
|
37
63
|
* @param {string} message - The error message to include.
|
|
@@ -2083,6 +2109,9 @@ async function parallelAllSettled (tasks, maxParallel = 5) {
|
|
|
2083
2109
|
* 3. Notice:
|
|
2084
2110
|
* * In Beginning, we start bulk(maxParallel) of tasks
|
|
2085
2111
|
* * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
|
|
2112
|
+
* * DO NOT ensure all tasks are executed.
|
|
2113
|
+
* * Tasks are NOT stoped immediately when a Task succeeds
|
|
2114
|
+
* * will be stopped when A bulk(maxParallel) is executed.
|
|
2086
2115
|
* @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
|
|
2087
2116
|
* @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
|
|
2088
2117
|
* @param {string} [failureMessage] - Error message when all tasks failed
|
|
@@ -2519,8 +2548,8 @@ function writeString (buffer, str, offset = 0) {
|
|
|
2519
2548
|
* * if dataLength <= 0, throw "Not Positive" Error
|
|
2520
2549
|
* * if dataLength is omitted, read all bytes from dataOffset to the end of dataArrayBuffer
|
|
2521
2550
|
* * if dataLength + dataOffset > dataArrayBuffer.length, read all bytes from dataOffset to the end of dataArrayBuffer
|
|
2522
|
-
* @param {ArrayBuffer} target - The target buffer to write into.
|
|
2523
|
-
* @param {ArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
|
|
2551
|
+
* @param {ArrayBuffer|SharedArrayBuffer} target - The target buffer to write into.
|
|
2552
|
+
* @param {ArrayBuffer|SharedArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
|
|
2524
2553
|
* @param {number} [targetOffset=0] - Zero-based index at which to start write.
|
|
2525
2554
|
* @param {number} [dataOffset=0] - The offset in the dataArrayBuffer
|
|
2526
2555
|
* @param {number} [dataLength] - how many bytes extract from dataArrayBuffer
|