UNPKG

@nktkas/hyperliquid

Version:

Unofficial Hyperliquid API SDK for all major JS runtimes, written in TypeScript and provided with tests

46 lines (45 loc) 1.48 kB
// Copyright 2018-2025 the Deno authors. MIT license. // This module is browser compatible. (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define(["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.concat = concat; /** * Concatenate an array of byte slices into a single slice. * * @param buffers Array of byte slices to concatenate. * @returns A new byte slice containing all the input slices concatenated. * * @example Basic usage * ```ts * import { concat } from "@std/bytes/concat"; * import { assertEquals } from "@std/assert"; * * const a = new Uint8Array([0, 1, 2]); * const b = new Uint8Array([3, 4, 5]); * * assertEquals(concat([a, b]), new Uint8Array([0, 1, 2, 3, 4, 5])); * ``` */ function concat(buffers) { let length = 0; for (const buffer of buffers) { length += buffer.length; } const output = new Uint8Array(length); let index = 0; for (const buffer of buffers) { output.set(buffer, index); index += buffer.length; } return output; } });