MCPcopy Create free account
hub / github.com/Project-DARC/DARC / toBigIntArray

Function toBigIntArray

darc-js/src/SDK/opcodes/utils.ts:8–19  ·  view source on GitHub ↗

* For any given array of numbers, convert them to BigInts * @param inputArray The array of numbers to be converted * @returns The array of BigInts

(inputArray: bigint[] | number[])

Source from the content-addressed store, hash-verified

6 * @returns The array of BigInts
7 */
8function toBigIntArray(inputArray: bigint[] | number[]): bigint[] {
9 let outputArray: bigint[] = [];
10 if (typeof inputArray[0] === "bigint") {
11 return inputArray as bigint[];
12 }
13 else if (typeof inputArray[0] === "number") {
14 for (let i = 0; i < inputArray.length; i++) {
15 outputArray.push(BigInt(inputArray[i]));
16 }
17 }
18 return outputArray;
19}
20
21/**
22 * This function checks if the input array is a valid array of bigints or numbers

Calls

no outgoing calls

Tested by

no test coverage detected