@creejs/commons-lang 2.1.9 → 2.1.11

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.
@@ -1,6 +1,7 @@
1
1
  declare namespace _default {
2
2
  export { readString };
3
3
  export { writeString };
4
+ export { writeArrayBuffer };
4
5
  }
5
6
  export default _default;
6
7
  /**
@@ -24,3 +25,27 @@ export function readString(buffer: ArrayBuffer, offset?: number, length?: number
24
25
  * @returns {void}
25
26
  */
26
27
  export function writeString(buffer: ArrayBuffer, str: string, offset?: number): void;
28
+ /**
29
+ * Writes an ArrayBuffer into a target ArrayBuffer at the specified offset.
30
+ * 1. targetOffset
31
+ * * Negative index counts back from the end of the buffer
32
+ * * if -target.length <= targetOffset < 0, start + target.length is used.
33
+ * * If targetOffset < -buffer.length or targetOffset is omitted, 0 is used.
34
+ * * If targetOffset >= buffer.length, throw "Out of target Bounds" Error
35
+ * 2. dataOffset
36
+ * * Negative index counts back from the end of the buffer
37
+ * * if -dataArrayBuffer.length <= dataOffset < 0, start + dataArrayBuffer.length is used.
38
+ * * If dataOffset < -buffer.length or dataOffset is omitted, 0 is used.
39
+ * * If dataOffset >= buffer.length, throw "Out of data Bounds" Error
40
+ * 3. dataLength
41
+ * * if dataLength <= 0, throw "Not Positive" Error
42
+ * * if dataLength is omitted, read all bytes from dataOffset to the end of dataArrayBuffer
43
+ * * if dataLength + dataOffset > dataArrayBuffer.length, read all bytes from dataOffset to the end of dataArrayBuffer
44
+ * @param {ArrayBuffer} target - The target buffer to write into.
45
+ * @param {ArrayBuffer} dataArrayBuffer - The data ArrayBuffer to write.
46
+ * @param {number} [targetOffset=0] - Zero-based index at which to start write.
47
+ * @param {number} [dataOffset=0] - The offset in the dataArrayBuffer
48
+ * @param {number} [dataLength] - how many bytes extract from dataArrayBuffer
49
+ * @returns {void}
50
+ */
51
+ export function writeArrayBuffer(target: ArrayBuffer, dataArrayBuffer: ArrayBuffer, targetOffset?: number, dataOffset?: number, dataLength?: number): void;
package/types/index.d.ts CHANGED
@@ -13,6 +13,7 @@ declare namespace _default {
13
13
  export { ReflectUtils };
14
14
  export { TypedArrayUtils };
15
15
  export { ArrayBufferUtils };
16
+ export { TimeUtils };
16
17
  }
17
18
  export default _default;
18
19
  import LangUtils from './lang-utils.js';
@@ -26,4 +27,5 @@ import InstanceProxyUtils from './instance-proxy-utils.js';
26
27
  import ReflectUtils from './reflect-utils.js';
27
28
  import TypedArrayUtils from './typed-array-utils.js';
28
29
  import ArrayBufferUtils from './array-buffer-utils.js';
29
- export { LangUtils, StringUtils, TypeUtils, TypeAssert, ExecUtils, PromiseUtils, LangUtils as Lang, TypeUtils as Type, ExecUtils as Exec, ClassProxyUtils, InstanceProxyUtils, ReflectUtils, TypedArrayUtils, ArrayBufferUtils };
30
+ import TimeUtils from './time-utils.js';
31
+ export { LangUtils, StringUtils, TypeUtils, TypeAssert, ExecUtils, PromiseUtils, LangUtils as Lang, TypeUtils as Type, ExecUtils as Exec, ClassProxyUtils, InstanceProxyUtils, ReflectUtils, TypedArrayUtils, ArrayBufferUtils, TimeUtils };
@@ -0,0 +1,10 @@
1
+ declare namespace _default {
2
+ export { timestamp64 };
3
+ }
4
+ export default _default;
5
+ /**
6
+ * Gets the current timestamp in nanoseconds (if running in Node.js) or milliseconds (in browser).
7
+ * Uses `process.hrtime.bigint()` for high-resolution timestamps in Node.js, falls back to `Date.now()` in browsers.
8
+ * @returns {bigint} Current timestamp as a BigInt
9
+ */
10
+ export function timestamp64(): bigint;