@helios-lang/codec-utils
Advanced tools
Comparing version 0.1.15 to 0.1.16
{ | ||
"name": "@helios-lang/codec-utils", | ||
"version": "0.1.15", | ||
"version": "0.1.16", | ||
"description": "Primitive manipulation functions commonly used in encoding and decoding algorithms", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
export class ByteStream { | ||
/** | ||
* @param {number[] | Uint8Array | ByteStream} bytes | ||
* @param {number[] | string | Uint8Array | ByteStream} bytes | ||
* @returns {ByteStream} | ||
*/ | ||
static from(bytes: number[] | Uint8Array | ByteStream): ByteStream; | ||
static from(bytes: number[] | string | Uint8Array | ByteStream): ByteStream; | ||
/** | ||
* Not intended for external use | ||
* @param {number[] | Uint8Array} bytes | ||
* @param {number[] | string | Uint8Array} bytes | ||
* @param {number} pos | ||
*/ | ||
constructor(bytes: number[] | Uint8Array, pos?: number); | ||
constructor(bytes: number[] | string | Uint8Array, pos?: number); | ||
/** | ||
@@ -14,0 +14,0 @@ * Copy ByteStream so mutations doesn't change original ByteStream |
@@ -0,1 +1,3 @@ | ||
import { hexToBytes } from "./base16.js" | ||
export class ByteStream { | ||
@@ -14,3 +16,3 @@ /** | ||
* Not intended for external use | ||
* @param {number[] | Uint8Array} bytes | ||
* @param {number[] | string | Uint8Array} bytes | ||
* @param {number} pos | ||
@@ -21,2 +23,4 @@ */ | ||
this.#bytes = bytes | ||
} else if (typeof bytes == "string") { | ||
this.#bytes = Uint8Array.from(hexToBytes(bytes)) | ||
} else { | ||
@@ -30,3 +34,3 @@ this.#bytes = Uint8Array.from(bytes) | ||
/** | ||
* @param {number[] | Uint8Array | ByteStream} bytes | ||
* @param {number[] | string | Uint8Array | ByteStream} bytes | ||
* @returns {ByteStream} | ||
@@ -33,0 +37,0 @@ */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64371
1960