@xylabs/hex
Advanced tools
Comparing version 3.5.1 to 3.5.2
@@ -5,5 +5,5 @@ import { AssertConfig } from './assert'; | ||
export declare const toAddress: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Address; | ||
export declare function asAddress(value: unknown): Address | undefined; | ||
export declare function asAddress(value: unknown, assert: AssertConfig): Address; | ||
//# sourceMappingURL=address.d.ts.map |
@@ -7,5 +7,5 @@ import { AssertConfig } from './assert'; | ||
export type Hash = Exclude<Hex, 'reserved-hash-value'>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Lowercase<string>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash; | ||
export declare function asHash(value: unknown): Hash | undefined; | ||
export declare function asHash(value: unknown, assert: AssertConfig): Hash; | ||
//# sourceMappingURL=hash.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Takes unknown value and tries our best to convert it to a hex string */ | ||
export declare const hexFrom: (value: unknown, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=from.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert an ArrayBuffer to a hex string */ | ||
export declare const hexFromArrayBuffer: (buffer: ArrayBuffer, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromArrayBuffer.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert a bigint to a hex string */ | ||
export declare const hexFromBigInt: (value: bigint, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromBigInt.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
import { Hex, HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Hex; | ||
//# sourceMappingURL=is.d.ts.map |
export type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>; | ||
/** Configuration of validation and output format */ | ||
export interface HexConfig { | ||
@@ -4,0 +3,0 @@ bitLength?: number; |
import { HexConfig } from './model'; | ||
/** takes any value and tries our best to convert it to a hex string */ | ||
export declare const toHex: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
//# sourceMappingURL=to.d.ts.map |
@@ -18,4 +18,3 @@ // src/assert.ts | ||
const nibbles = value >> 2; | ||
if (value !== nibbles << 2) | ||
throw new Error("Bits for nibbles must multiple of 4"); | ||
if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4"); | ||
return nibbles; | ||
@@ -33,7 +32,5 @@ }; | ||
var isHex = (value, config) => { | ||
if (typeof value !== "string") | ||
return false; | ||
if (typeof value !== "string") return false; | ||
const valueCharLength = config?.prefix ? value.length - 2 : value.length; | ||
if (config?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config?.bitLength)) | ||
return false; | ||
if (config?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config?.bitLength)) return false; | ||
return config?.prefix ? hexRegexWithPrefix.test(value) : hexRegex.test(value); | ||
@@ -40,0 +37,0 @@ }; |
@@ -5,5 +5,5 @@ import { AssertConfig } from './assert'; | ||
export declare const toAddress: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Address; | ||
export declare function asAddress(value: unknown): Address | undefined; | ||
export declare function asAddress(value: unknown, assert: AssertConfig): Address; | ||
//# sourceMappingURL=address.d.ts.map |
@@ -7,5 +7,5 @@ import { AssertConfig } from './assert'; | ||
export type Hash = Exclude<Hex, 'reserved-hash-value'>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Lowercase<string>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash; | ||
export declare function asHash(value: unknown): Hash | undefined; | ||
export declare function asHash(value: unknown, assert: AssertConfig): Hash; | ||
//# sourceMappingURL=hash.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Takes unknown value and tries our best to convert it to a hex string */ | ||
export declare const hexFrom: (value: unknown, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=from.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert an ArrayBuffer to a hex string */ | ||
export declare const hexFromArrayBuffer: (buffer: ArrayBuffer, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromArrayBuffer.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert a bigint to a hex string */ | ||
export declare const hexFromBigInt: (value: bigint, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromBigInt.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
import { Hex, HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Hex; | ||
//# sourceMappingURL=is.d.ts.map |
export type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>; | ||
/** Configuration of validation and output format */ | ||
export interface HexConfig { | ||
@@ -4,0 +3,0 @@ bitLength?: number; |
import { HexConfig } from './model'; | ||
/** takes any value and tries our best to convert it to a hex string */ | ||
export declare const toHex: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
//# sourceMappingURL=to.d.ts.map |
@@ -18,4 +18,3 @@ // src/assert.ts | ||
const nibbles = value >> 2; | ||
if (value !== nibbles << 2) | ||
throw new Error("Bits for nibbles must multiple of 4"); | ||
if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4"); | ||
return nibbles; | ||
@@ -33,7 +32,5 @@ }; | ||
var isHex = (value, config) => { | ||
if (typeof value !== "string") | ||
return false; | ||
if (typeof value !== "string") return false; | ||
const valueCharLength = config?.prefix ? value.length - 2 : value.length; | ||
if (config?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config?.bitLength)) | ||
return false; | ||
if (config?.bitLength !== void 0 && valueCharLength !== bitsToNibbles(config?.bitLength)) return false; | ||
return config?.prefix ? hexRegexWithPrefix.test(value) : hexRegex.test(value); | ||
@@ -40,0 +37,0 @@ }; |
@@ -5,5 +5,5 @@ import { AssertConfig } from './assert'; | ||
export declare const toAddress: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
export declare const isAddress: (value: unknown, config?: HexConfig) => value is Address; | ||
export declare function asAddress(value: unknown): Address | undefined; | ||
export declare function asAddress(value: unknown, assert: AssertConfig): Address; | ||
//# sourceMappingURL=address.d.ts.map |
@@ -7,5 +7,5 @@ import { AssertConfig } from './assert'; | ||
export type Hash = Exclude<Hex, 'reserved-hash-value'>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Lowercase<string>; | ||
export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash; | ||
export declare function asHash(value: unknown): Hash | undefined; | ||
export declare function asHash(value: unknown, assert: AssertConfig): Hash; | ||
//# sourceMappingURL=hash.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Takes unknown value and tries our best to convert it to a hex string */ | ||
export declare const hexFrom: (value: unknown, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=from.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert an ArrayBuffer to a hex string */ | ||
export declare const hexFromArrayBuffer: (buffer: ArrayBuffer, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromArrayBuffer.d.ts.map |
import { Hex, HexConfig } from '../model'; | ||
/** Convert a bigint to a hex string */ | ||
export declare const hexFromBigInt: (value: bigint, config?: HexConfig) => Hex; | ||
//# sourceMappingURL=fromBigInt.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Lowercase<string>; | ||
import { Hex, HexConfig } from './model'; | ||
export declare const isHex: (value: unknown, config?: HexConfig) => value is Hex; | ||
//# sourceMappingURL=is.d.ts.map |
export type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>; | ||
/** Configuration of validation and output format */ | ||
export interface HexConfig { | ||
@@ -4,0 +3,0 @@ bitLength?: number; |
import { HexConfig } from './model'; | ||
/** takes any value and tries our best to convert it to a hex string */ | ||
export declare const toHex: (value: unknown, config?: HexConfig) => Lowercase<string>; | ||
//# sourceMappingURL=to.d.ts.map |
@@ -18,4 +18,3 @@ // src/assert.ts | ||
const nibbles = value >> 2; | ||
if (value !== nibbles << 2) | ||
throw new Error("Bits for nibbles must multiple of 4"); | ||
if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4"); | ||
return nibbles; | ||
@@ -33,7 +32,5 @@ }; | ||
var isHex = (value, config) => { | ||
if (typeof value !== "string") | ||
return false; | ||
if (typeof value !== "string") return false; | ||
const valueCharLength = (config == null ? void 0 : config.prefix) ? value.length - 2 : value.length; | ||
if ((config == null ? void 0 : config.bitLength) !== void 0 && valueCharLength !== bitsToNibbles(config == null ? void 0 : config.bitLength)) | ||
return false; | ||
if ((config == null ? void 0 : config.bitLength) !== void 0 && valueCharLength !== bitsToNibbles(config == null ? void 0 : config.bitLength)) return false; | ||
return (config == null ? void 0 : config.prefix) ? hexRegexWithPrefix.test(value) : hexRegex.test(value); | ||
@@ -40,0 +37,0 @@ }; |
@@ -42,8 +42,8 @@ { | ||
"dependencies": { | ||
"@xylabs/arraybuffer": "~3.5.1" | ||
"@xylabs/arraybuffer": "~3.5.2" | ||
}, | ||
"devDependencies": { | ||
"@xylabs/ts-scripts-yarn3": "^3.10.4", | ||
"@xylabs/tsconfig": "^3.10.4", | ||
"typescript": "^5.4.5" | ||
"@xylabs/ts-scripts-yarn3": "^3.11.10", | ||
"@xylabs/tsconfig": "^3.11.10", | ||
"typescript": "^5.5.2" | ||
}, | ||
@@ -61,4 +61,4 @@ "engines": { | ||
"sideEffects": false, | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"type": "module" | ||
} |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
222147
1611
7
Updated@xylabs/arraybuffer@~3.5.2