@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.
@@ -38,6 +38,32 @@
38
38
  return err._type === '_' && typeof err.code === 'number'
39
39
  }
40
40
 
41
+ /**
42
+ *
43
+ * @param {string} message
44
+ * @param {number} time ms
45
+ * @returns {_Error}
46
+ */
47
+ static timeout (message, time) {
48
+ return new _Error(`Timeout ${time}ms: ${message}`, 504)
49
+ }
50
+
51
+ /**
52
+ * "412 Precondition Failed" indicates that one or more conditions
53
+ * given in the request header fields evaluated to false when tested on the server.
54
+ * * Header Purpose
55
+ * * If-Match Only proceed if the resource's ETag matches the given value
56
+ * * If-None-Match Only proceed if the resource's ETag doesn't match the given value
57
+ * * If-Modified-Since Only proceed if the resource was modified after the given date
58
+ * * If-Unmodified-Since Only proceed if the resource wasn't modified after the given date
59
+
60
+ * @param {string} message
61
+ * @returns {_Error}
62
+ */
63
+ static preconditionFailed (message) {
64
+ return new _Error(`Not Matched: ${message}`, 412)
65
+ }
66
+
41
67
  /**
42
68
  * Creates and returns a 404 Not Found error instance with the given message.
43
69
  * @param {string} message - The error message to include.
@@ -2089,6 +2115,9 @@
2089
2115
  * 3. Notice:
2090
2116
  * * In Beginning, we start bulk(maxParallel) of tasks
2091
2117
  * * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
2118
+ * * DO NOT ensure all tasks are executed.
2119
+ * * Tasks are NOT stoped immediately when a Task succeeds
2120
+ * * will be stopped when A bulk(maxParallel) is executed.
2092
2121
  * @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
2093
2122
  * @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
2094
2123
  * @param {string} [failureMessage] - Error message when all tasks failed
@@ -2525,8 +2554,8 @@
2525
2554
  * * if dataLength <= 0, throw "Not Positive" Error
2526
2555
  * * if dataLength is omitted, read all bytes from dataOffset to the end of dataArrayBuffer
2527
2556
  * * if dataLength + dataOffset > dataArrayBuffer.length, read all bytes from dataOffset to the end of dataArrayBuffer
2528
- * @param {ArrayBuffer} target - The target buffer to write into.
2529
- * @param {ArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
2557
+ * @param {ArrayBuffer|SharedArrayBuffer} target - The target buffer to write into.
2558
+ * @param {ArrayBuffer|SharedArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
2530
2559
  * @param {number} [targetOffset=0] - Zero-based index at which to start write.
2531
2560
  * @param {number} [dataOffset=0] - The offset in the dataArrayBuffer
2532
2561
  * @param {number} [dataLength] - how many bytes extract from dataArrayBuffer