UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

42 lines (41 loc) 1.49 kB
"use strict"; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.concatUint8Arr = void 0; function concatUint8Arr() { var e_1, _a; var arrs = []; for (var _i = 0; _i < arguments.length; _i++) { arrs[_i] = arguments[_i]; } arrs = arrs.map(function (arr) { return arr instanceof Uint8Array ? arr : new Uint8Array(arr.buffer); }); var len = arrs.reduce(function (acc, arr) { return acc + arr.length; }, 0); var res = new Uint8Array(len); var idx = 0; try { for (var arrs_1 = __values(arrs), arrs_1_1 = arrs_1.next(); !arrs_1_1.done; arrs_1_1 = arrs_1.next()) { var arr = arrs_1_1.value; res.set(arr, idx); idx += arr.length; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (arrs_1_1 && !arrs_1_1.done && (_a = arrs_1.return)) _a.call(arrs_1); } finally { if (e_1) throw e_1.error; } } return res; } exports.concatUint8Arr = concatUint8Arr;