summaryrefslogtreecommitdiff
path: root/node_modules/capnp-ts/src/util.d.ts
diff options
context:
space:
mode:
authorakiyamn2023-09-24 23:22:21 +1000
committerakiyamn2023-09-24 23:22:21 +1000
commit4e87195739f2a5d9a05451b48773c8afdc680765 (patch)
tree9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/capnp-ts/src/util.d.ts
downloadprice-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz
price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/capnp-ts/src/util.d.ts')
-rw-r--r--node_modules/capnp-ts/src/util.d.ts75
1 files changed, 75 insertions, 0 deletions
diff --git a/node_modules/capnp-ts/src/util.d.ts b/node_modules/capnp-ts/src/util.d.ts
new file mode 100644
index 0000000..00c805e
--- /dev/null
+++ b/node_modules/capnp-ts/src/util.d.ts
@@ -0,0 +1,75 @@
+/**
+ * @author jdiaz5513
+ */
+/**
+ * Dump a hex string from the given buffer.
+ *
+ * @export
+ * @param {ArrayBuffer} buffer The buffer to convert.
+ * @returns {string} A hexadecimal string representing the buffer.
+ */
+export declare function bufferToHex(buffer: ArrayBuffer): string;
+/**
+ * Throw an error if the provided value cannot be represented as a 32-bit integer.
+ *
+ * @export
+ * @param {number} value The number to check.
+ * @returns {number} The same number if it is valid.
+ */
+export declare function checkInt32(value: number): number;
+export declare function checkUint32(value: number): number;
+/**
+ * Decode a UTF-8 encoded byte array into a JavaScript string (UCS-2).
+ *
+ * @export
+ * @param {Uint8Array} src A utf-8 encoded byte array.
+ * @returns {string} A string representation of the byte array.
+ */
+export declare function decodeUtf8(src: Uint8Array): string;
+export declare function dumpBuffer(buffer: ArrayBuffer | ArrayBufferView): string;
+/**
+ * Encode a JavaScript string (UCS-2) to a UTF-8 encoded string inside a Uint8Array.
+ *
+ * Note that the underlying buffer for the array will likely be larger than the actual contents; ignore the extra bytes.
+ *
+ * @export
+ * @param {string} src The input string.
+ * @returns {Uint8Array} A UTF-8 encoded buffer with the string's contents.
+ */
+export declare function encodeUtf8(src: string): Uint8Array;
+/**
+ * Produce a `printf`-style string. Nice for providing arguments to `assert` without paying the cost for string
+ * concatenation up front. Precision is supported for floating point numbers.
+ *
+ * @param {string} s The format string. Supported format specifiers: b, c, d, f, j, o, s, x, and X.
+ * @param {...any} args Values to be formatted in the string. Arguments beyond what are consumed by the format string
+ * are ignored.
+ * @returns {string} The formatted string.
+ */
+export declare function format(s: string, ...args: unknown[]): string;
+/**
+ * Return the thing that was passed in. Yaaaaawn.
+ *
+ * @export
+ * @template T
+ * @param {T} x A thing.
+ * @returns {T} The same thing.
+ */
+export declare function identity<T>(x: T): T;
+export declare function pad(v: string, width: number, pad?: string): string;
+/**
+ * Add padding to a number to make it divisible by 8. Typically used to pad byte sizes so they align to a word boundary.
+ *
+ * @export
+ * @param {number} size The number to pad.
+ * @returns {number} The padded number.
+ */
+export declare function padToWord(size: number): number;
+/**
+ * Repeat a string n times. Shamelessly copied from lodash.repeat.
+ *
+ * @param {number} times Number of times to repeat.
+ * @param {string} str The string to repeat.
+ * @returns {string} The repeated string.
+ */
+export declare function repeat(times: number, str: string): string;