@harmoniclabs/plutus-data
Advanced tools
+13
-12
@@ -36,18 +36,19 @@ "use strict"; | ||
| // any unrecognized tag | ||
| tag < BigInt(0) || | ||
| !(Object.getPrototypeOf(data) === cbor_1.CborArray.prototype) || | ||
| !(data instanceof cbor_1.CborArray) // for typescript to be happy | ||
| ) { | ||
| tag < BigInt(0) | ||
| || !(data instanceof cbor_1.CborArray)) { | ||
| // ignore the tag and and treats the object as if it were normal CBOR | ||
| return dataFromCborObj(data); | ||
| } | ||
| if (tag === BigInt(102)) { | ||
| (0, assert_1.assert)(data.array.length === 2 && | ||
| data.array[0] instanceof cbor_1.CborUInt && | ||
| data.array[1] instanceof cbor_1.CborArray, "invalid fileds for cbor tag 102 while constructing DataConstr"); | ||
| return new DataConstr_1.DataConstr(data.array[0].num, data.array[1].array.map(dataFromCborObj)); | ||
| if (tag === BigInt(102) | ||
| // DO NOT REMOVE | ||
| // THIS IS A FIX TO A EDGE CASE | ||
| // `cborTagToConstrNumber` will return 102 for cbor tag 1375 ( which is a DataConstr tag 102 ) | ||
| && cborObj.tag !== BigInt(1375)) { | ||
| var dataArr = data.array; | ||
| if (!(dataArr.length === 2 && | ||
| dataArr[0] instanceof cbor_1.CborUInt && | ||
| dataArr[1] instanceof cbor_1.CborArray)) | ||
| throw new Error("invalid fileds for cbor tag 102 while constructing DataConstr"); | ||
| return new DataConstr_1.DataConstr(dataArr[0].num, dataArr[1].array.map(dataFromCborObj)); | ||
| } | ||
| (0, assert_1.assert)((Object.getPrototypeOf(data) === cbor_1.CborArray.prototype) && | ||
| (data instanceof cbor_1.CborArray), // for typescript to be happy | ||
| "invalid CBOR fields for DataConstr"); | ||
| return new DataConstr_1.DataConstr(tag, data.array.map(dataFromCborObj)); | ||
@@ -54,0 +55,0 @@ } |
| import { Data } from "../Data.js"; | ||
| export type ToDataVersion = "v1" | "v2" | "v3"; | ||
| export interface ToData { | ||
| toData: (version?: "v1" | "v2" | "v3") => Data; | ||
| toData: (version?: ToDataVersion) => Data; | ||
| } |
+1
-1
| { | ||
| "name": "@harmoniclabs/plutus-data", | ||
| "version": "1.2.4", | ||
| "version": "1.2.6", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
999
0.2%39119
-0.07%