@creejs/commons-lang 2.1.27 → 2.1.29
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 +60 -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 +60 -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 +60 -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 +13 -0
- package/types/array-buffer-utils.d.ts +3 -3
- package/types/promise-utils.d.ts +3 -0
package/dist/umd/index.dev.js
CHANGED
|
@@ -38,6 +38,22 @@
|
|
|
38
38
|
return err._type === '_' && typeof err.code === 'number'
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* "412 Precondition Failed" indicates that one or more conditions
|
|
43
|
+
* given in the request header fields evaluated to false when tested on the server.
|
|
44
|
+
* * Header Purpose
|
|
45
|
+
* * If-Match Only proceed if the resource's ETag matches the given value
|
|
46
|
+
* * If-None-Match Only proceed if the resource's ETag doesn't match the given value
|
|
47
|
+
* * If-Modified-Since Only proceed if the resource was modified after the given date
|
|
48
|
+
* * If-Unmodified-Since Only proceed if the resource wasn't modified after the given date
|
|
49
|
+
|
|
50
|
+
* @param {string} message
|
|
51
|
+
* @returns {_Error}
|
|
52
|
+
*/
|
|
53
|
+
static PreconditionFailed (message) {
|
|
54
|
+
return new _Error(`Not Found: ${message}`, 412)
|
|
55
|
+
}
|
|
56
|
+
|
|
41
57
|
/**
|
|
42
58
|
* Creates and returns a 404 Not Found error instance with the given message.
|
|
43
59
|
* @param {string} message - The error message to include.
|
|
@@ -1543,6 +1559,45 @@
|
|
|
1543
1559
|
} else if (value === undefined) {
|
|
1544
1560
|
return 'undefined'
|
|
1545
1561
|
}
|
|
1562
|
+
const type = typeof value;
|
|
1563
|
+
if (type === 'string') {
|
|
1564
|
+
return value
|
|
1565
|
+
} else if (type === 'symbol') {
|
|
1566
|
+
return `Symbol(${value.description})`
|
|
1567
|
+
} else if (type === 'function') {
|
|
1568
|
+
return `Function ${value.name}(){}`
|
|
1569
|
+
}
|
|
1570
|
+
if (value instanceof String) {
|
|
1571
|
+
return value.toString()
|
|
1572
|
+
}
|
|
1573
|
+
if (Number.isNaN(value)) {
|
|
1574
|
+
return 'NaN'
|
|
1575
|
+
}
|
|
1576
|
+
if (value === Infinity) {
|
|
1577
|
+
return 'Infinity'
|
|
1578
|
+
}
|
|
1579
|
+
if (value === -Infinity) {
|
|
1580
|
+
return '-Infinity'
|
|
1581
|
+
}
|
|
1582
|
+
if (value instanceof Error) {
|
|
1583
|
+
return `${value.constructor.name}: ${value.message}`
|
|
1584
|
+
}
|
|
1585
|
+
if (value instanceof Promise) {
|
|
1586
|
+
return 'Promise'
|
|
1587
|
+
}
|
|
1588
|
+
if (value instanceof Set) {
|
|
1589
|
+
return `Set: ${safeToString(Array.from(value))}`
|
|
1590
|
+
}
|
|
1591
|
+
if (value instanceof Map) {
|
|
1592
|
+
return `Map: ${safeToString(Array.from(value.entries()))}`
|
|
1593
|
+
}
|
|
1594
|
+
if (value instanceof RegExp) {
|
|
1595
|
+
return value.toString()
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
if (Array.isArray(value)) {
|
|
1599
|
+
return `[${value.map(safeToString).join(', ')}]`
|
|
1600
|
+
}
|
|
1546
1601
|
let valueStr;
|
|
1547
1602
|
try {
|
|
1548
1603
|
valueStr = JSON.stringify(value);
|
|
@@ -2050,6 +2105,9 @@
|
|
|
2050
2105
|
* 3. Notice:
|
|
2051
2106
|
* * In Beginning, we start bulk(maxParallel) of tasks
|
|
2052
2107
|
* * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
|
|
2108
|
+
* * DO NOT ensure all tasks are executed.
|
|
2109
|
+
* * Tasks are NOT stoped immediately when a Task succeeds
|
|
2110
|
+
* * will be stopped when A bulk(maxParallel) is executed.
|
|
2053
2111
|
* @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
|
|
2054
2112
|
* @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
|
|
2055
2113
|
* @param {string} [failureMessage] - Error message when all tasks failed
|
|
@@ -2486,8 +2544,8 @@
|
|
|
2486
2544
|
* * if dataLength <= 0, throw "Not Positive" Error
|
|
2487
2545
|
* * if dataLength is omitted, read all bytes from dataOffset to the end of dataArrayBuffer
|
|
2488
2546
|
* * if dataLength + dataOffset > dataArrayBuffer.length, read all bytes from dataOffset to the end of dataArrayBuffer
|
|
2489
|
-
* @param {ArrayBuffer} target - The target buffer to write into.
|
|
2490
|
-
* @param {ArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
|
|
2547
|
+
* @param {ArrayBuffer|SharedArrayBuffer} target - The target buffer to write into.
|
|
2548
|
+
* @param {ArrayBuffer|SharedArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
|
|
2491
2549
|
* @param {number} [targetOffset=0] - Zero-based index at which to start write.
|
|
2492
2550
|
* @param {number} [dataOffset=0] - The offset in the dataArrayBuffer
|
|
2493
2551
|
* @param {number} [dataLength] - how many bytes extract from dataArrayBuffer
|