Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@helios-lang/codec-utils

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helios-lang/codec-utils - npm Package Compare versions

Comparing version 0.1.18 to 0.1.19

7

package.json
{
"name": "@helios-lang/codec-utils",
"version": "0.1.18",
"version": "0.1.19",
"description": "Primitive manipulation functions commonly used in encoding and decoding algorithms",

@@ -14,3 +14,6 @@ "main": "src/index.js",

"prettify": "npx prettier . --write",
"test": "npx prettier . --check && tsc -p jsconfig.json --noEmit && node --test --experimental-test-coverage"
"test": "npm run test:pretty && npm run test:types && npm run test:suite",
"test:pretty": "npx prettier . --check",
"test:suite": "node --test --experimental-test-coverage",
"test:types": "tsc -p jsconfig.json --noEmit"
},

@@ -17,0 +20,0 @@ "author": "Christian Schmitz",

@@ -16,2 +16,11 @@ /**

/**
* @typedef {string | number[] | {bytes: number[]}} ByteArrayLike
*/
/**
* Permissive conversion to bytes
* @param {ByteArrayLike} b
* @returns {number[]}
*/
export function toBytes(b: ByteArrayLike): number[];
/**
* Converts a list of uint8 bytes into its hexadecimal string representation.

@@ -24,2 +33,5 @@ * @example

export function bytesToHex(bytes: number[]): string;
export type ByteArrayLike = string | number[] | {
bytes: number[];
};
//# sourceMappingURL=base16.d.ts.map

@@ -48,2 +48,23 @@ import { padBits } from "../bits/index.js"

/**
* @typedef {string | number[] | {bytes: number[]}} ByteArrayLike
*/
/**
* Permissive conversion to bytes
* @param {ByteArrayLike} b
* @returns {number[]}
*/
export function toBytes(b) {
if (Array.isArray(b)) {
return b
} else if (typeof b == "string") {
return hexToBytes(b)
} else if (typeof b == "object" && "bytes" in b) {
return b.bytes
} else {
throw new Error("not ByteArrayLike")
}
}
/**
* Converts a list of uint8 bytes into its hexadecimal string representation.

@@ -50,0 +71,0 @@ * @example

export { ByteStream } from "./ByteStream.js";
export { bytesToHex, hexToBytes } from "./base16.js";
export type ByteArrayLike = import("./base16.js").ByteArrayLike;
export { bytesToHex, hexToBytes, toBytes } from "./base16.js";
export { Base32, decodeBase32, encodeBase32, isValidBase32 } from "./base32.js";

@@ -4,0 +5,0 @@ export { Base64, decodeBase64, encodeBase64, isValidBase64 } from "./base64.js";

export { ByteStream } from "./ByteStream.js"
export { bytesToHex, hexToBytes } from "./base16.js"
export { bytesToHex, hexToBytes, toBytes } from "./base16.js"
export { Base32, decodeBase32, encodeBase32, isValidBase32 } from "./base32.js"
export { Base64, decodeBase64, encodeBase64, isValidBase64 } from "./base64.js"
export { compareBytes, padBytes } from "./ops.js"
/**
* @typedef {import("./base16.js").ByteArrayLike} ByteArrayLike
*/

@@ -10,5 +10,5 @@ /**

* @param {Option<T>} opt
* @returns {opt is null}
* @returns {opt is (null | undefined)}
*/
export function isNone<T>(opt: Option<T>): opt is null;
export function isNone<T>(opt: Option<T>): opt is null | undefined;
/**

@@ -15,0 +15,0 @@ * @template T

@@ -23,3 +23,3 @@ /**

* @param {Option<T>} opt
* @returns {opt is null}
* @returns {opt is (null | undefined)}
*/

@@ -26,0 +26,0 @@ export function isNone(opt) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc