@helios-lang/uplc
Advanced tools
Comparing version 0.1.12 to 0.1.13
{ | ||
"name": "@helios-lang/uplc", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "Cardano Untyped Plutus Core utility library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -43,5 +43,5 @@ /** | ||
* @param {boolean} lengthFirst - defaults to false | ||
* @returns {-1 | 0 | 1} - `-1` -> lt, `0` -> equals, `1` -> gt | ||
* @returns {number} - `-1` -> lt, `0` -> equals, `1` -> gt | ||
*/ | ||
static compare(a: number[], b: number[], lengthFirst?: boolean): -1 | 0 | 1; | ||
static compare(a: number[], b: number[], lengthFirst?: boolean): number; | ||
/** | ||
@@ -48,0 +48,0 @@ * @param {number[]} bytes |
@@ -1,2 +0,7 @@ | ||
import { ByteStream, bytesToHex, encodeUtf8 } from "@helios-lang/codec-utils" | ||
import { | ||
ByteStream, | ||
bytesToHex, | ||
compareBytes, | ||
encodeUtf8 | ||
} from "@helios-lang/codec-utils" | ||
import { decodeBytes, encodeBytes } from "@helios-lang/cbor" | ||
@@ -140,25 +145,7 @@ import { UPLC_DATA_NODE_MEM_SIZE } from "./UplcData.js" | ||
* @param {boolean} lengthFirst - defaults to false | ||
* @returns {-1 | 0 | 1} - `-1` -> lt, `0` -> equals, `1` -> gt | ||
* @returns {number} - `-1` -> lt, `0` -> equals, `1` -> gt | ||
*/ | ||
static compare(a, b, lengthFirst = false) { | ||
if (a.length != b.length) { | ||
if (!lengthFirst) { | ||
for (let i = 0; i < Math.min(a.length, b.length); i++) { | ||
if (a[i] != b[i]) { | ||
return a[i] < b[i] ? -1 : 1 | ||
} | ||
} | ||
} | ||
return a.length < b.length ? -1 : 1 | ||
} else { | ||
for (let i = 0; i < a.length; i++) { | ||
if (a[i] != b[i]) { | ||
return a[i] < b[i] ? -1 : 1 | ||
} | ||
} | ||
return 0 | ||
} | ||
return compareBytes(a, b, lengthFirst) | ||
} | ||
} |
@@ -5,3 +5,4 @@ export * from "./data/index.js"; | ||
export * as v3 from "./v3/index.js"; | ||
export type Cost = import("./v1/costmodel/index.js").Cost; | ||
export type UplcData = import("./data/index.js").UplcData; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,3 +7,7 @@ export * from "./data/index.js" | ||
/** | ||
* @typedef {import("./v1/costmodel/index.js").Cost} Cost | ||
*/ | ||
/** | ||
* @typedef {import("./data/index.js").UplcData} UplcData | ||
*/ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
307185
9198