MCPcopy Create free account
hub / github.com/CashScript/cashscript / decodeBool

Function decodeBool

packages/utils/src/data.ts:14–24  ·  view source on GitHub ↗
(encodedBool: Uint8Array)

Source from the content-addressed store, hash-verified

12}
13
14export function decodeBool(encodedBool: Uint8Array): boolean {
15 // Any encoding of 0 is false, else true
16 for (let i = 0; i < encodedBool.byteLength; i += 1) {
17 if (encodedBool[i] !== 0) {
18 // Can be negative zero
19 if (i === encodedBool.byteLength - 1 && encodedBool[i] === 0x80) return false;
20 return true;
21 }
22 }
23 return false;
24}
25
26export function encodeInt(int: bigint): Uint8Array {
27 return bigIntToVmNumber(int);

Callers 2

decodeStackItemFunction · 0.90
data.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected