New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ox

Package Overview
Dependencies
Maintainers
0
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ox - npm Package Compare versions

Comparing version 0.0.0-20240815T061458 to 0.0.0-20240816T000930

_cjs/internal/bytes/assert.d.ts

1

_cjs/Bytes.d.ts

@@ -0,1 +1,2 @@

export { assertBytes, assertBytes as assert } from './internal/bytes/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isBytes } from './internal/data/isBytes.js';

5

_cjs/Bytes.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toHex = exports.bytesToHex = exports.from = exports.toBytes = exports.fromString = exports.stringToBytes = exports.fromNumber = exports.fromBigInt = exports.numberToBytes = exports.fromHex = exports.hexToBytes = exports.fromBoolean = exports.booleanToBytes = exports.toString = exports.bytesToString = exports.toNumber = exports.bytesToNumber = exports.toBoolean = exports.bytesToBoolean = exports.toBigInt = exports.bytesToBigInt = exports.to = exports.fromBytes = exports.random = exports.randomBytes = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isBytes = exports.concat = void 0;
exports.toHex = exports.bytesToHex = exports.from = exports.toBytes = exports.fromString = exports.stringToBytes = exports.fromNumber = exports.fromBigInt = exports.numberToBytes = exports.fromHex = exports.hexToBytes = exports.fromBoolean = exports.booleanToBytes = exports.toString = exports.bytesToString = exports.toNumber = exports.bytesToNumber = exports.toBoolean = exports.bytesToBoolean = exports.toBigInt = exports.bytesToBigInt = exports.to = exports.fromBytes = exports.random = exports.randomBytes = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isBytes = exports.concat = exports.assert = exports.assertBytes = void 0;
var assert_js_1 = require("./internal/bytes/assert.js");
Object.defineProperty(exports, "assertBytes", { enumerable: true, get: function () { return assert_js_1.assertBytes; } });
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_js_1.assertBytes; } });
var concat_js_1 = require("./internal/data/concat.js");

@@ -5,0 +8,0 @@ Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_js_1.concat; } });

@@ -1,5 +0,5 @@

export { BaseError, type BaseErrorType, setErrorConfig, } from './internal/errors/base.js';
export { NegativeOffsetError, type NegativeOffsetErrorType, PositionOutOfBoundsError, type PositionOutOfBoundsErrorType, RecursiveReadLimitExceededError, type RecursiveReadLimitExceededErrorType, } from './internal/errors/cursor.js';
export { IntegerOutOfRangeError, type IntegerOutOfRangeErrorType, InvalidBytesBooleanError, type InvalidBytesBooleanErrorType, InvalidHexBooleanError, type InvalidHexBooleanErrorType, InvalidHexValueError, type InvalidHexValueErrorType, InvalidTypeError, type InvalidTypeErrorType, SizeExceedsPaddingSizeError, type SizeExceedsPaddingSizeErrorType, SizeOverflowError, type SizeOverflowErrorType, SliceOffsetOutOfBoundsError, type SliceOffsetOutOfBoundsErrorType, } from './internal/errors/data.js';
export { BaseError, type BaseErrorType, } from './internal/errors/base.js';
export { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError, } from './internal/errors/cursor.js';
export { IntegerOutOfRangeError, InvalidBytesBooleanError, InvalidHexBooleanError, InvalidHexLengthError, InvalidTypeError, SizeExceedsPaddingSizeError, SizeOverflowError, SliceOffsetOutOfBoundsError, } from './internal/errors/data.js';
export type { ErrorType } from './internal/errors/error.js';
//# sourceMappingURL=Errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SliceOffsetOutOfBoundsError = exports.SizeOverflowError = exports.SizeExceedsPaddingSizeError = exports.InvalidTypeError = exports.InvalidHexValueError = exports.InvalidHexBooleanError = exports.InvalidBytesBooleanError = exports.IntegerOutOfRangeError = exports.RecursiveReadLimitExceededError = exports.PositionOutOfBoundsError = exports.NegativeOffsetError = exports.setErrorConfig = exports.BaseError = void 0;
exports.SliceOffsetOutOfBoundsError = exports.SizeOverflowError = exports.SizeExceedsPaddingSizeError = exports.InvalidTypeError = exports.InvalidHexLengthError = exports.InvalidHexBooleanError = exports.InvalidBytesBooleanError = exports.IntegerOutOfRangeError = exports.RecursiveReadLimitExceededError = exports.PositionOutOfBoundsError = exports.NegativeOffsetError = exports.BaseError = void 0;
var base_js_1 = require("./internal/errors/base.js");
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_js_1.BaseError; } });
Object.defineProperty(exports, "setErrorConfig", { enumerable: true, get: function () { return base_js_1.setErrorConfig; } });
var cursor_js_1 = require("./internal/errors/cursor.js");

@@ -15,3 +14,3 @@ Object.defineProperty(exports, "NegativeOffsetError", { enumerable: true, get: function () { return cursor_js_1.NegativeOffsetError; } });

Object.defineProperty(exports, "InvalidHexBooleanError", { enumerable: true, get: function () { return data_js_1.InvalidHexBooleanError; } });
Object.defineProperty(exports, "InvalidHexValueError", { enumerable: true, get: function () { return data_js_1.InvalidHexValueError; } });
Object.defineProperty(exports, "InvalidHexLengthError", { enumerable: true, get: function () { return data_js_1.InvalidHexLengthError; } });
Object.defineProperty(exports, "InvalidTypeError", { enumerable: true, get: function () { return data_js_1.InvalidTypeError; } });

@@ -18,0 +17,0 @@ Object.defineProperty(exports, "SizeExceedsPaddingSizeError", { enumerable: true, get: function () { return data_js_1.SizeExceedsPaddingSizeError; } });

@@ -0,1 +1,2 @@

export { assertHex, assertHex as assert } from './internal/hex/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isHex } from './internal/data/isHex.js';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.random = exports.from = exports.toHex = exports.fromString = exports.stringToHex = exports.fromNumber = exports.fromBigInt = exports.numberToHex = exports.fromBytes = exports.bytesToHex = exports.fromBoolean = exports.booleanToHex = exports.toBytes = exports.hexToBytes = exports.toString = exports.hexToString = exports.toNumber = exports.hexToNumber = exports.toBoolean = exports.hexToBoolean = exports.toBigInt = exports.hexToBigInt = exports.to = exports.fromHex = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isHex = exports.concat = void 0;
exports.random = exports.from = exports.toHex = exports.fromString = exports.stringToHex = exports.fromNumber = exports.fromBigInt = exports.numberToHex = exports.fromBytes = exports.bytesToHex = exports.fromBoolean = exports.booleanToHex = exports.toBytes = exports.hexToBytes = exports.toString = exports.hexToString = exports.toNumber = exports.hexToNumber = exports.toBoolean = exports.hexToBoolean = exports.toBigInt = exports.hexToBigInt = exports.to = exports.fromHex = exports.trimRight = exports.trimLeft = exports.size = exports.slice = exports.padRight = exports.padLeft = exports.isEqual = exports.isHex = exports.concat = exports.assert = exports.assertHex = void 0;
var assert_js_1 = require("./internal/hex/assert.js");
Object.defineProperty(exports, "assertHex", { enumerable: true, get: function () { return assert_js_1.assertHex; } });
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_js_1.assertHex; } });
var concat_js_1 = require("./internal/data/concat.js");

@@ -5,0 +8,0 @@ Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return concat_js_1.concat; } });

import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -14,3 +14,3 @@ import { hexToBigInt, hexToNumber } from '../hex/fromHex.js';

type ReturnType<to extends To> = (to extends 'string' ? string : never) | (to extends 'hex' ? Hex : never) | (to extends 'bigint' ? bigint : never) | (to extends 'number' ? number : never) | (to extends 'boolean' ? boolean : never);
type ErrorType = bytesToBigInt.ErrorType | bytesToBoolean.ErrorType | bytesToNumber.ErrorType | bytesToString.ErrorType | bytesToHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = bytesToBigInt.ErrorType | bytesToBoolean.ErrorType | bytesToNumber.ErrorType | bytesToString.ErrorType | bytesToHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -17,0 +17,0 @@ export declare function fromBytes<to extends 'string' | 'hex' | 'bigint' | 'number' | 'boolean'>(bytes: Bytes, to: to | To, options?: fromBytes.Options): fromBytes.ReturnType<to>;

@@ -24,3 +24,3 @@ "use strict";

return (0, toHex_js_1.bytesToHex)(bytes, options);
throw new data_js_1.InvalidTypeError(to);
throw new data_js_1.InvalidTypeError(to, 'string | hex | bigint | number | boolean');
}

@@ -27,0 +27,0 @@ function bytesToBigInt(bytes, options = {}) {

@@ -5,3 +5,3 @@ import { assertSize } from '../data/assertSize.js';

import { padLeft, padRight } from '../data/pad.js';
import { type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -14,3 +14,3 @@ import { numberToHex } from '../hex/toHex.js';

};
type ErrorType = numberToBytes.ErrorType | booleanToBytes.ErrorType | hexToBytes.ErrorType | stringToBytes.ErrorType | isBytes.ErrorType | isHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = numberToBytes.ErrorType | booleanToBytes.ErrorType | hexToBytes.ErrorType | stringToBytes.ErrorType | isBytes.ErrorType | isHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -17,0 +17,0 @@ export declare function toBytes(value: string | bigint | number | boolean | Hex | Bytes | readonly number[], options?: toBytes.Options): Bytes;

@@ -28,3 +28,3 @@ "use strict";

return numberToBytes(value, options);
throw new data_js_1.InvalidTypeError(typeof value);
throw new data_js_1.InvalidTypeError(typeof value, 'string | bigint | number | boolean | Bytes | Hex | readonly number[]');
}

@@ -60,2 +60,4 @@ function booleanToBytes(value, options = {}) {

const { size } = options;
if (hex_.length % 2)
throw new data_js_1.InvalidHexLengthError(hex_);
let hex = hex_;

@@ -66,5 +68,3 @@ if (size) {

}
let hexString = hex.slice(2);
if (hexString.length % 2)
hexString = `0${hexString}`;
const hexString = hex.slice(2);
const length = hexString.length / 2;

@@ -71,0 +71,0 @@ const bytes = new Uint8Array(length);

@@ -1,2 +0,2 @@

import { NegativeOffsetError, type NegativeOffsetErrorType, type PositionOutOfBoundsErrorType, type RecursiveReadLimitExceededErrorType } from './errors/cursor.js';
import { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError } from './errors/cursor.js';
import type { ErrorType as ErrorType_ } from './errors/error.js';

@@ -39,6 +39,6 @@ import type { Bytes } from './types/data.js';

type CursorErrorType = CursorAssertPositionErrorType | CursorDecrementPositionErrorType | CursorIncrementPositionErrorType | ErrorType_;
type CursorAssertPositionErrorType = PositionOutOfBoundsErrorType | ErrorType_;
type CursorAssertPositionErrorType = PositionOutOfBoundsError | ErrorType_;
type CursorDecrementPositionErrorType = NegativeOffsetError | ErrorType_;
type CursorIncrementPositionErrorType = NegativeOffsetError | ErrorType_;
type StaticCursorErrorType = NegativeOffsetErrorType | RecursiveReadLimitExceededErrorType;
type StaticCursorErrorType = NegativeOffsetError | RecursiveReadLimitExceededError;
export declare namespace createCursor {

@@ -45,0 +45,0 @@ type Config = {

@@ -1,2 +0,2 @@

import { type SizeOverflowErrorType } from '../errors/data.js';
import { SizeOverflowError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -6,5 +6,5 @@ import type { Bytes, Hex } from '../types/data.js';

export declare namespace assertSize {
type ErrorType = size.ErrorType | SizeOverflowErrorType | ErrorType_;
type ErrorType = size.ErrorType | SizeOverflowError | ErrorType_;
}
export declare function assertSize(hexOrBytes: Hex | Bytes, size_: number): void;
//# sourceMappingURL=assertSize.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBytes = isBytes;
const assert_js_1 = require("../bytes/assert.js");
function isBytes(value) {
if (!value)
try {
(0, assert_js_1.assertBytes)(value);
return true;
}
catch {
return false;
if (typeof value !== 'object')
return false;
if (!('BYTES_PER_ELEMENT' in value))
return false;
return (value.BYTES_PER_ELEMENT === 1 && value.constructor.name === 'Uint8Array');
}
}
//# sourceMappingURL=isBytes.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isHex = isHex;
const assert_js_1 = require("../hex/assert.js");
function isHex(value, options = {}) {
const { strict = true } = options;
if (!value)
try {
(0, assert_js_1.assertHex)(value, { strict });
return true;
}
catch {
return false;
if (typeof value !== 'string')
return false;
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');
}
}
//# sourceMappingURL=isHex.js.map

@@ -1,2 +0,2 @@

import { type SizeExceedsPaddingSizeErrorType } from '../errors/data.js';
import { SizeExceedsPaddingSizeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -24,8 +24,8 @@ import type { Bytes, Hex } from '../types/data.js';

type Options = pad.Options;
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_;
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_;
}
export declare namespace padBytes {
type Options = pad.Options;
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_;
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_;
}
//# sourceMappingURL=pad.d.ts.map

@@ -1,2 +0,2 @@

import { type SliceOffsetOutOfBoundsErrorType } from '../errors/data.js';
import { SliceOffsetOutOfBoundsError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -15,7 +15,7 @@ import type { Bytes, Hex } from '../types/data.js';

declare namespace assertStartOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_;
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_;
}
declare function assertStartOffset(value: Hex | Bytes, start?: number | undefined): void;
declare namespace assertEndOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_;
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_;
}

@@ -22,0 +22,0 @@ declare function assertEndOffset(value: Hex | Bytes, start?: number | undefined, end?: number | undefined): void;

@@ -1,14 +0,6 @@

type ErrorConfig = {
getDocsUrl?: ((args: BaseErrorParameters) => string | undefined) | undefined;
version?: string | undefined;
};
export declare function setErrorConfig(config: ErrorConfig): void;
type BaseErrorParameters = {
cause?: BaseError | Error | undefined;
details?: string | undefined;
docsBaseUrl?: string | undefined;
docsPath?: string | undefined;
docsSlug?: string | undefined;
metaMessages?: string[] | undefined;
name?: string | undefined;
};

@@ -20,7 +12,7 @@ export type BaseErrorType = BaseError & {

details: string;
docs?: string | undefined;
docsPath?: string | undefined;
metaMessages?: string[] | undefined;
shortMessage: string;
name: string;
version: string;
name: string;
constructor(shortMessage: string, args?: BaseErrorParameters);

@@ -27,0 +19,0 @@ walk(): Error;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseError = void 0;
exports.setErrorConfig = setErrorConfig;
const version_js_1 = require("../../version.js");
let errorConfig = {
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
? `${docsBaseUrl ?? 'https://oxlib.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`
: undefined,
version: version_js_1.version,
};
function setErrorConfig(config) {
errorConfig = config;
}
const utils_js_1 = require("./utils.js");
class BaseError extends Error {

@@ -29,11 +19,10 @@ constructor(shortMessage, args = {}) {

})();
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
const docsBaseUrl = 'https://oxlib.sh';
const docs = `${docsBaseUrl}${docsPath ?? ''}`;
const message = [
shortMessage || 'An error occurred.',
'',
...(args.metaMessages ? [...args.metaMessages, ''] : []),
...(docsUrl ? [`Docs: ${docsUrl}`] : []),
...(details ? [`Details: ${details}`] : []),
...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),
].join('\n');
docsPath && `\nSee: ${docs}`,
]
.filter((x) => typeof x === 'string')
.join('\n');
super(message, args.cause ? { cause: args.cause } : undefined);

@@ -46,3 +35,3 @@ Object.defineProperty(this, "details", {

});
Object.defineProperty(this, "docsPath", {
Object.defineProperty(this, "docs", {
enumerable: true,

@@ -53,3 +42,3 @@ configurable: true,

});
Object.defineProperty(this, "metaMessages", {
Object.defineProperty(this, "docsPath", {
enumerable: true,

@@ -66,20 +55,18 @@ configurable: true,

});
Object.defineProperty(this, "version", {
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
value: 'BaseError'
});
Object.defineProperty(this, "name", {
Object.defineProperty(this, "version", {
enumerable: true,
configurable: true,
writable: true,
value: 'BaseError'
value: `ox@${(0, utils_js_1.getVersion)()}`
});
this.details = details;
this.docs = docs;
this.docsPath = docsPath;
this.metaMessages = args.metaMessages;
this.name = args.name ?? this.name;
this.shortMessage = shortMessage;
this.version = version_js_1.version;
}

@@ -86,0 +73,0 @@ walk(fn) {

import { BaseError } from './base.js';
export type NegativeOffsetErrorType = NegativeOffsetError & {
name: 'NegativeOffsetError';
};
export declare class NegativeOffsetError extends BaseError {
readonly name = "NegativeOffsetError";
constructor({ offset }: {

@@ -10,6 +8,4 @@ offset: number;

}
export type PositionOutOfBoundsErrorType = PositionOutOfBoundsError & {
name: 'PositionOutOfBoundsError';
};
export declare class PositionOutOfBoundsError extends BaseError {
readonly name = "PositionOutOfBoundsError";
constructor({ length, position }: {

@@ -20,6 +16,4 @@ length: number;

}
export type RecursiveReadLimitExceededErrorType = RecursiveReadLimitExceededError & {
name: 'RecursiveReadLimitExceededError';
};
export declare class RecursiveReadLimitExceededError extends BaseError {
readonly name = "RecursiveReadLimitExceededError";
constructor({ count, limit }: {

@@ -26,0 +20,0 @@ count: number;

@@ -7,4 +7,8 @@ "use strict";

constructor({ offset }) {
super(`Offset \`${offset}\` cannot be negative.`, {
name: 'NegativeOffsetError',
super(`Offset \`${offset}\` cannot be negative.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'NegativeOffsetError'
});

@@ -16,4 +20,8 @@ }

constructor({ length, position }) {
super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, {
name: 'PositionOutOfBoundsError',
super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'PositionOutOfBoundsError'
});

@@ -25,4 +33,8 @@ }

constructor({ count, limit }) {
super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, {
name: 'RecursiveReadLimitExceededError',
super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'RecursiveReadLimitExceededError'
});

@@ -29,0 +41,0 @@ }

import type { Bytes, Hex } from '../types/data.js';
import { BaseError } from './base.js';
export type IntegerOutOfRangeErrorType = IntegerOutOfRangeError & {
name: 'IntegerOutOfRangeError';
};
export declare class IntegerOutOfRangeError extends BaseError {
readonly name = "IntegerOutOfRangeError";
constructor({ max, min, signed, size, value, }: {

@@ -15,30 +13,32 @@ max?: string | undefined;

}
export type InvalidBytesBooleanErrorType = InvalidBytesBooleanError & {
name: 'InvalidBytesBooleanError';
};
export declare class InvalidBytesBooleanError extends BaseError {
readonly name = "InvalidBytesBooleanError";
constructor(bytes: Bytes);
}
export type InvalidHexBooleanErrorType = InvalidHexBooleanError & {
name: 'InvalidHexBooleanError';
};
export declare class InvalidHexBooleanError extends BaseError {
readonly name = "InvalidHexBooleanError";
constructor(hex: Hex);
}
export type InvalidHexValueErrorType = InvalidHexValueError & {
name: 'InvalidHexValueError';
};
export declare class InvalidHexValueError extends BaseError {
export declare class InvalidBytesTypeError extends BaseError {
readonly name = "InvalidBytesTypeError";
constructor(value: unknown);
}
export declare class InvalidHexLengthError extends BaseError {
readonly name = "InvalidHexLengthError";
constructor(value: Hex);
}
export type InvalidTypeErrorType = InvalidTypeError & {
name: 'InvalidTypeError';
};
export declare class InvalidHexTypeError extends BaseError {
readonly name = "InvalidHexTypeError";
constructor(value: unknown);
}
export declare class InvalidHexValueError extends BaseError {
readonly name = "InvalidHexValueError";
constructor(value: unknown);
}
export declare class InvalidTypeError extends BaseError {
constructor(type: string);
readonly name = "InvalidTypeError";
constructor(type: string, expected: string);
}
export type SizeOverflowErrorType = SizeOverflowError & {
name: 'SizeOverflowError';
};
export declare class SizeOverflowError extends BaseError {
readonly name = "SizeOverflowError";
constructor({ givenSize, maxSize }: {

@@ -49,6 +49,4 @@ givenSize: number;

}
export type SliceOffsetOutOfBoundsErrorType = SliceOffsetOutOfBoundsError & {
name: 'SliceOffsetOutOfBoundsError';
};
export declare class SliceOffsetOutOfBoundsError extends BaseError {
readonly name = "SliceOffsetOutOfBoundsError";
constructor({ offset, position, size, }: {

@@ -60,6 +58,4 @@ offset: number;

}
export type SizeExceedsPaddingSizeErrorType = SizeExceedsPaddingSizeError & {
name: 'SizeExceedsPaddingSizeError';
};
export declare class SizeExceedsPaddingSizeError extends BaseError {
readonly name = "SizeExceedsPaddingSizeError";
constructor({ size, targetSize, type, }: {

@@ -66,0 +62,0 @@ size: number;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SizeExceedsPaddingSizeError = exports.SliceOffsetOutOfBoundsError = exports.SizeOverflowError = exports.InvalidTypeError = exports.InvalidHexValueError = exports.InvalidHexBooleanError = exports.InvalidBytesBooleanError = exports.IntegerOutOfRangeError = void 0;
exports.SizeExceedsPaddingSizeError = exports.SliceOffsetOutOfBoundsError = exports.SizeOverflowError = exports.InvalidTypeError = exports.InvalidHexValueError = exports.InvalidHexTypeError = exports.InvalidHexLengthError = exports.InvalidBytesTypeError = exports.InvalidHexBooleanError = exports.InvalidBytesBooleanError = exports.IntegerOutOfRangeError = void 0;
const base_js_1 = require("./base.js");
class IntegerOutOfRangeError extends base_js_1.BaseError {
constructor({ max, min, signed, size, value, }) {
super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' });
super(`Number \`${value}\` is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`, {
docsPath: '/errors#integeroutofrangeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'IntegerOutOfRangeError'
});
}

@@ -13,5 +21,11 @@ }

constructor(bytes) {
super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
name: 'InvalidBytesBooleanError',
super(`Bytes value \`${bytes}\` is not a valid boolean. The bytes array must contain a single byte of either a \`0\` or \`1\` value.`, {
docsPath: '/errors#invalidbytesbooleanerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidBytesBooleanError'
});
}

@@ -22,11 +36,67 @@ }

constructor(hex) {
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: 'InvalidHexBooleanError' });
super(`Hex value \`"${hex}"\` is not a valid boolean. The hex value must be \`"0x0"\` (false) or \`"0x1"\` (true).`, {
docsPath: '/errors#invalidhexbooleanerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexBooleanError'
});
}
}
exports.InvalidHexBooleanError = InvalidHexBooleanError;
class InvalidBytesTypeError extends base_js_1.BaseError {
constructor(value) {
super(`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value. Bytes values must be of type \`Bytes\`.`, {
docsPath: '/errors#invalidbytestypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidBytesTypeError'
});
}
}
exports.InvalidBytesTypeError = InvalidBytesTypeError;
class InvalidHexLengthError extends base_js_1.BaseError {
constructor(value) {
super(`Hex value \`"${value}"\` is an odd length (${value.length - 2} nibbles). It must be an even length.`, {
docsPath: '/errors#invalidhexlengtherror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexLengthError'
});
}
}
exports.InvalidHexLengthError = InvalidHexLengthError;
class InvalidHexTypeError extends base_js_1.BaseError {
constructor(value) {
super(`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type. Hex types must be represented as \`"0x$\{string}"\`.`, {
docsPath: '/errors#invalidhextypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexTypeError'
});
}
}
exports.InvalidHexTypeError = InvalidHexTypeError;
class InvalidHexValueError extends base_js_1.BaseError {
constructor(value) {
super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, {
name: 'InvalidHexValueError',
super(`Value \`${value}\` is an invalid hex value. Hex values must start with "0x" and contain only hexadecimal characters (0-9, a-f, A-F).`, {
docsPath: '/errors#invalidhexvalueerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexValueError'
});
}

@@ -36,4 +106,12 @@ }

class InvalidTypeError extends base_js_1.BaseError {
constructor(type) {
super(`Type "${type}" is invalid.`, { name: 'InvalidTypeError' });
constructor(type, expected) {
super(`Type \`${type}\` is invalid. Expected: \`${expected}\``, {
docsPath: '/errors#invalidtypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidTypeError'
});
}

@@ -44,5 +122,11 @@ }

constructor({ givenSize, maxSize }) {
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, {
name: 'SizeOverflowError',
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`, {
docsPath: '/errors#sizeoverflowerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SizeOverflowError'
});
}

@@ -53,3 +137,11 @@ }

constructor({ offset, position, size, }) {
super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset "${offset}" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' });
super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset \`${offset}\` is out-of-bounds (size: \`${size}\`).`, {
docsPath: '/errors#sliceoffsetoutofboundserror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SliceOffsetOutOfBoundsError'
});
}

@@ -62,3 +154,11 @@ }

.slice(1)
.toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' });
.toLowerCase()} size (\`${size}\`) exceeds padding size (\`${targetSize}\`).`, {
docsPath: '/errors#sizeexceedspaddingsizeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SizeExceedsPaddingSizeError'
});
}

@@ -65,0 +165,0 @@ }

import { hexToBytes } from '../bytes/toBytes.js';
import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { type InvalidHexBooleanErrorType, type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidHexBooleanError, InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -13,3 +13,3 @@ import type { Bytes, Hex } from '../types/data.js';

type ReturnType<to> = (to extends 'string' ? string : never) | (to extends 'bytes' ? Bytes : never) | (to extends 'bigint' ? bigint : never) | (to extends 'number' ? number : never) | (to extends 'boolean' ? boolean : never);
type ErrorType = hexToNumber.ErrorType | hexToBigInt.ErrorType | hexToBoolean.ErrorType | hexToString.ErrorType | hexToBytes.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = hexToNumber.ErrorType | hexToBigInt.ErrorType | hexToBoolean.ErrorType | hexToString.ErrorType | hexToBytes.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -29,3 +29,3 @@ export declare function fromHex<to extends To>(hex: Hex, to: to | To, options?: fromHex.Options): fromHex.ReturnType<to>;

};
type ErrorType = assertSize.ErrorType | trimLeft.ErrorType | InvalidHexBooleanErrorType | ErrorType_;
type ErrorType = assertSize.ErrorType | trimLeft.ErrorType | InvalidHexBooleanError | ErrorType_;
}

@@ -32,0 +32,0 @@ export declare function hexToBoolean(hex_: Hex, options?: hexToBoolean.Options): boolean;

@@ -23,3 +23,3 @@ "use strict";

return (0, toBytes_js_1.hexToBytes)(hex, options);
throw new data_js_1.InvalidTypeError(to);
throw new data_js_1.InvalidTypeError(to, 'string | bytes | bigint | number | boolean');
}

@@ -26,0 +26,0 @@ function hexToBigInt(hex, options = {}) {

import { assertSize } from '../data/assertSize.js';
import { isHex } from '../data/isHex.js';
import { padLeft, padRight } from '../data/pad.js';
import { type IntegerOutOfRangeErrorType, type InvalidTypeErrorType } from '../errors/data.js';
import { IntegerOutOfRangeError, InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -11,3 +11,3 @@ import type { Bytes, Hex } from '../types/data.js';

};
type ErrorType = booleanToHex.ErrorType | bytesToHex.ErrorType | numberToHex.ErrorType | stringToHex.ErrorType | isHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = booleanToHex.ErrorType | bytesToHex.ErrorType | numberToHex.ErrorType | stringToHex.ErrorType | isHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -37,3 +37,3 @@ export declare function toHex(value: string | number | bigint | boolean | readonly number[] | Bytes, options?: toHex.Parameters): Hex;

};
type ErrorType = IntegerOutOfRangeErrorType | padLeft.ErrorType | ErrorType_;
type ErrorType = IntegerOutOfRangeError | padLeft.ErrorType | ErrorType_;
}

@@ -40,0 +40,0 @@ export declare function numberToHex(value_: number | bigint, options?: numberToHex.Options): Hex;

@@ -27,6 +27,6 @@ "use strict";

return booleanToHex(value, options);
throw new data_js_1.InvalidTypeError(typeof value);
throw new data_js_1.InvalidTypeError(typeof value, 'string | number | bigint | boolean | Bytes | readonly number[]');
}
function booleanToHex(value, options = {}) {
const hex = `0x${Number(value)}`;
const hex = `0x0${Number(value)}`;
if (typeof options.size === 'number') {

@@ -73,5 +73,4 @@ (0, assertSize_js_1.assertSize)(hex, options.size);

}
const hex = `0x${(signed && value < 0
? (1n << BigInt(size * 8)) + BigInt(value)
: value).toString(16)}`;
const stringValue = (signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16);
const hex = `0x${stringValue.length % 2 === 0 ? stringValue : `0${stringValue}`}`;
if (size)

@@ -78,0 +77,0 @@ return (0, pad_js_1.padLeft)(hex, size);

import { hexToBytes } from '../bytes/toBytes.js';
import { type Cursor, createCursor } from '../cursor.js';
import { type BaseErrorType } from '../errors/base.js';
import { type InvalidHexValueErrorType } from '../errors/data.js';
import { InvalidHexLengthError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -12,3 +12,3 @@ import { bytesToHex } from '../hex/toHex.js';

type ReturnType<to extends To> = (to extends 'bytes' ? RecursiveArray<Bytes> : never) | (to extends 'hex' ? RecursiveArray<Hex> : never);
type ErrorType = hexToBytes.ErrorType | fromRlpCursor.ErrorType | createCursor.ErrorType | InvalidHexValueErrorType | ErrorType_;
type ErrorType = hexToBytes.ErrorType | fromRlpCursor.ErrorType | createCursor.ErrorType | InvalidHexLengthError | ErrorType_;
}

@@ -15,0 +15,0 @@ export declare function fromRlp<value extends Bytes | Hex, to extends To = value extends Bytes ? 'bytes' : 'hex'>(value: value, to_?: to | To | undefined): fromRlp.ReturnType<to>;

@@ -16,3 +16,3 @@ "use strict";

if (value.length > 3 && value.length % 2 !== 0)
throw new data_js_1.InvalidHexValueError(value);
throw new data_js_1.InvalidHexLengthError(value);
return (0, toBytes_js_1.hexToBytes)(value);

@@ -19,0 +19,0 @@ }

@@ -1,2 +0,2 @@

export declare const version = "0.0.0-20240815T061458";
export declare const version = "0.0.0-20240816T000930";
//# sourceMappingURL=version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = '0.0.0-20240815T061458';
exports.version = '0.0.0-20240816T000930';
//# sourceMappingURL=version.js.map

@@ -0,1 +1,2 @@

export { assertBytes, assertBytes as assert } from './internal/bytes/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isBytes } from './internal/data/isBytes.js';

@@ -0,1 +1,2 @@

export { assertBytes, assertBytes as assert } from './internal/bytes/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isBytes } from './internal/data/isBytes.js';

@@ -1,5 +0,5 @@

export { BaseError, type BaseErrorType, setErrorConfig, } from './internal/errors/base.js';
export { NegativeOffsetError, type NegativeOffsetErrorType, PositionOutOfBoundsError, type PositionOutOfBoundsErrorType, RecursiveReadLimitExceededError, type RecursiveReadLimitExceededErrorType, } from './internal/errors/cursor.js';
export { IntegerOutOfRangeError, type IntegerOutOfRangeErrorType, InvalidBytesBooleanError, type InvalidBytesBooleanErrorType, InvalidHexBooleanError, type InvalidHexBooleanErrorType, InvalidHexValueError, type InvalidHexValueErrorType, InvalidTypeError, type InvalidTypeErrorType, SizeExceedsPaddingSizeError, type SizeExceedsPaddingSizeErrorType, SizeOverflowError, type SizeOverflowErrorType, SliceOffsetOutOfBoundsError, type SliceOffsetOutOfBoundsErrorType, } from './internal/errors/data.js';
export { BaseError, type BaseErrorType, } from './internal/errors/base.js';
export { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError, } from './internal/errors/cursor.js';
export { IntegerOutOfRangeError, InvalidBytesBooleanError, InvalidHexBooleanError, InvalidHexLengthError, InvalidTypeError, SizeExceedsPaddingSizeError, SizeOverflowError, SliceOffsetOutOfBoundsError, } from './internal/errors/data.js';
export type { ErrorType } from './internal/errors/error.js';
//# sourceMappingURL=Errors.d.ts.map

@@ -1,4 +0,4 @@

export { BaseError, setErrorConfig, } from './internal/errors/base.js';
export { BaseError, } from './internal/errors/base.js';
export { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError, } from './internal/errors/cursor.js';
export { IntegerOutOfRangeError, InvalidBytesBooleanError, InvalidHexBooleanError, InvalidHexValueError, InvalidTypeError, SizeExceedsPaddingSizeError, SizeOverflowError, SliceOffsetOutOfBoundsError, } from './internal/errors/data.js';
export { IntegerOutOfRangeError, InvalidBytesBooleanError, InvalidHexBooleanError, InvalidHexLengthError, InvalidTypeError, SizeExceedsPaddingSizeError, SizeOverflowError, SliceOffsetOutOfBoundsError, } from './internal/errors/data.js';
//# sourceMappingURL=Errors.js.map

@@ -0,1 +1,2 @@

export { assertHex, assertHex as assert } from './internal/hex/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isHex } from './internal/data/isHex.js';

@@ -0,1 +1,2 @@

export { assertHex, assertHex as assert } from './internal/hex/assert.js';
export { concat } from './internal/data/concat.js';

@@ -2,0 +3,0 @@ export { isHex } from './internal/data/isHex.js';

import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -15,3 +15,3 @@ import { hexToBigInt, hexToNumber } from '../hex/fromHex.js';

type ReturnType<to extends To> = (to extends 'string' ? string : never) | (to extends 'hex' ? Hex : never) | (to extends 'bigint' ? bigint : never) | (to extends 'number' ? number : never) | (to extends 'boolean' ? boolean : never);
type ErrorType = bytesToBigInt.ErrorType | bytesToBoolean.ErrorType | bytesToNumber.ErrorType | bytesToString.ErrorType | bytesToHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = bytesToBigInt.ErrorType | bytesToBoolean.ErrorType | bytesToNumber.ErrorType | bytesToString.ErrorType | bytesToHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -18,0 +18,0 @@ /**

import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { InvalidBytesBooleanError, InvalidTypeError, } from '../errors/data.js';
import { InvalidBytesBooleanError, InvalidTypeError } from '../errors/data.js';
import { hexToBigInt, hexToNumber } from '../hex/fromHex.js';

@@ -35,3 +35,3 @@ import { bytesToHex } from '../hex/toHex.js';

return bytesToHex(bytes, options);
throw new InvalidTypeError(to);
throw new InvalidTypeError(to, 'string | hex | bigint | number | boolean');
}

@@ -38,0 +38,0 @@ /**

@@ -5,3 +5,3 @@ import { assertSize } from '../data/assertSize.js';

import { padLeft, padRight } from '../data/pad.js';
import { type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -15,3 +15,3 @@ import { numberToHex } from '../hex/toHex.js';

};
type ErrorType = numberToBytes.ErrorType | booleanToBytes.ErrorType | hexToBytes.ErrorType | stringToBytes.ErrorType | isBytes.ErrorType | isHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = numberToBytes.ErrorType | booleanToBytes.ErrorType | hexToBytes.ErrorType | stringToBytes.ErrorType | isBytes.ErrorType | isHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -18,0 +18,0 @@ /**

@@ -6,3 +6,3 @@ import { assertSize } from '../data/assertSize.js';

import { BaseError } from '../errors/base.js';
import { InvalidTypeError } from '../errors/data.js';
import { InvalidHexLengthError, InvalidTypeError } from '../errors/data.js';
import { numberToHex } from '../hex/toHex.js';

@@ -42,3 +42,3 @@ /**

return numberToBytes(value, options);
throw new InvalidTypeError(typeof value);
throw new InvalidTypeError(typeof value, 'string | bigint | number | boolean | Bytes | Hex | readonly number[]');
}

@@ -110,2 +110,4 @@ /**

const { size } = options;
if (hex_.length % 2)
throw new InvalidHexLengthError(hex_);
let hex = hex_;

@@ -116,5 +118,3 @@ if (size) {

}
let hexString = hex.slice(2);
if (hexString.length % 2)
hexString = `0${hexString}`;
const hexString = hex.slice(2);
const length = hexString.length / 2;

@@ -121,0 +121,0 @@ const bytes = new Uint8Array(length);

@@ -1,2 +0,2 @@

import { NegativeOffsetError, type NegativeOffsetErrorType, type PositionOutOfBoundsErrorType, type RecursiveReadLimitExceededErrorType } from './errors/cursor.js';
import { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError } from './errors/cursor.js';
import type { ErrorType as ErrorType_ } from './errors/error.js';

@@ -39,6 +39,6 @@ import type { Bytes } from './types/data.js';

type CursorErrorType = CursorAssertPositionErrorType | CursorDecrementPositionErrorType | CursorIncrementPositionErrorType | ErrorType_;
type CursorAssertPositionErrorType = PositionOutOfBoundsErrorType | ErrorType_;
type CursorAssertPositionErrorType = PositionOutOfBoundsError | ErrorType_;
type CursorDecrementPositionErrorType = NegativeOffsetError | ErrorType_;
type CursorIncrementPositionErrorType = NegativeOffsetError | ErrorType_;
type StaticCursorErrorType = NegativeOffsetErrorType | RecursiveReadLimitExceededErrorType;
type StaticCursorErrorType = NegativeOffsetError | RecursiveReadLimitExceededError;
export declare namespace createCursor {

@@ -45,0 +45,0 @@ type Config = {

@@ -1,2 +0,2 @@

import { type SizeOverflowErrorType } from '../errors/data.js';
import { SizeOverflowError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -6,3 +6,3 @@ import type { Bytes, Hex } from '../types/data.js';

export declare namespace assertSize {
type ErrorType = size.ErrorType | SizeOverflowErrorType | ErrorType_;
type ErrorType = size.ErrorType | SizeOverflowError | ErrorType_;
}

@@ -9,0 +9,0 @@ /** @internal */

@@ -1,2 +0,2 @@

import { SizeOverflowError, } from '../errors/data.js';
import { SizeOverflowError } from '../errors/data.js';
import { size } from './size.js';

@@ -3,0 +3,0 @@ /** @internal */

@@ -0,1 +1,2 @@

import { assertBytes } from '../bytes/assert.js';
/**

@@ -12,10 +13,10 @@ * Checks if the given value is {@link Bytes}.

export function isBytes(value) {
if (!value)
try {
assertBytes(value);
return true;
}
catch {
return false;
if (typeof value !== 'object')
return false;
if (!('BYTES_PER_ELEMENT' in value))
return false;
return (value.BYTES_PER_ELEMENT === 1 && value.constructor.name === 'Uint8Array');
}
}
//# sourceMappingURL=isBytes.js.map

@@ -0,1 +1,2 @@

import { assertHex } from '../hex/assert.js';
/**

@@ -13,8 +14,10 @@ * Checks if the given value is {@link Hex}.

const { strict = true } = options;
if (!value)
try {
assertHex(value, { strict });
return true;
}
catch {
return false;
if (typeof value !== 'string')
return false;
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');
}
}
//# sourceMappingURL=isHex.js.map

@@ -1,2 +0,2 @@

import { type SizeExceedsPaddingSizeErrorType } from '../errors/data.js';
import { SizeExceedsPaddingSizeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -56,8 +56,8 @@ import type { Bytes, Hex } from '../types/data.js';

type Options = pad.Options;
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_;
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_;
}
export declare namespace padBytes {
type Options = pad.Options;
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_;
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_;
}
//# sourceMappingURL=pad.d.ts.map

@@ -1,2 +0,2 @@

import { SizeExceedsPaddingSizeError, } from '../errors/data.js';
import { SizeExceedsPaddingSizeError } from '../errors/data.js';
/**

@@ -3,0 +3,0 @@ * Pads a {@link Bytes} or {@link Hex} value to the left with zero bytes until it reaches the given `size` (default: 32 bytes).

@@ -1,2 +0,2 @@

import { type SliceOffsetOutOfBoundsErrorType } from '../errors/data.js';
import { SliceOffsetOutOfBoundsError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -34,7 +34,7 @@ import type { Bytes, Hex } from '../types/data.js';

declare namespace assertStartOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_;
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_;
}
declare function assertStartOffset(value: Hex | Bytes, start?: number | undefined): void;
declare namespace assertEndOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_;
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_;
}

@@ -41,0 +41,0 @@ declare function assertEndOffset(value: Hex | Bytes, start?: number | undefined, end?: number | undefined): void;

@@ -1,2 +0,2 @@

import { SliceOffsetOutOfBoundsError, } from '../errors/data.js';
import { SliceOffsetOutOfBoundsError } from '../errors/data.js';
import { isHex } from './isHex.js';

@@ -3,0 +3,0 @@ import { size } from './size.js';

@@ -1,26 +0,6 @@

type ErrorConfig = {
getDocsUrl?: ((args: BaseErrorParameters) => string | undefined) | undefined;
version?: string | undefined;
};
/**
* Sets the global error configuration.
*
* @example
* import { Errors } from 'ox'
* Errors.setErrorConfig({
* getDocsUrl({ name }) {
* return `https://mylib.sh/docs/errors?name=${name}`
* },
* version: 'mylib@1.0.0',
* })
*/
export declare function setErrorConfig(config: ErrorConfig): void;
type BaseErrorParameters = {
cause?: BaseError | Error | undefined;
details?: string | undefined;
docsBaseUrl?: string | undefined;
docsPath?: string | undefined;
docsSlug?: string | undefined;
metaMessages?: string[] | undefined;
name?: string | undefined;
};

@@ -39,7 +19,7 @@ export type BaseErrorType = BaseError & {

details: string;
docs?: string | undefined;
docsPath?: string | undefined;
metaMessages?: string[] | undefined;
shortMessage: string;
name: string;
version: string;
name: string;
constructor(shortMessage: string, args?: BaseErrorParameters);

@@ -46,0 +26,0 @@ walk(): Error;

@@ -1,24 +0,3 @@

import { version } from '../../version.js';
let errorConfig = {
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
? `${docsBaseUrl ?? 'https://oxlib.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`
: undefined,
version,
};
import { getVersion } from './utils.js';
/**
* Sets the global error configuration.
*
* @example
* import { Errors } from 'ox'
* Errors.setErrorConfig({
* getDocsUrl({ name }) {
* return `https://mylib.sh/docs/errors?name=${name}`
* },
* version: 'mylib@1.0.0',
* })
*/
export function setErrorConfig(config) {
errorConfig = config;
}
/**
* Base error class inherited by all errors thrown by ox.

@@ -44,11 +23,10 @@ *

})();
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
const docsBaseUrl = 'https://oxlib.sh';
const docs = `${docsBaseUrl}${docsPath ?? ''}`;
const message = [
shortMessage || 'An error occurred.',
'',
...(args.metaMessages ? [...args.metaMessages, ''] : []),
...(docsUrl ? [`Docs: ${docsUrl}`] : []),
...(details ? [`Details: ${details}`] : []),
...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),
].join('\n');
docsPath && `\nSee: ${docs}`,
]
.filter((x) => typeof x === 'string')
.join('\n');
super(message, args.cause ? { cause: args.cause } : undefined);

@@ -61,3 +39,3 @@ Object.defineProperty(this, "details", {

});
Object.defineProperty(this, "docsPath", {
Object.defineProperty(this, "docs", {
enumerable: true,

@@ -68,3 +46,3 @@ configurable: true,

});
Object.defineProperty(this, "metaMessages", {
Object.defineProperty(this, "docsPath", {
enumerable: true,

@@ -81,20 +59,18 @@ configurable: true,

});
Object.defineProperty(this, "version", {
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
value: 'BaseError'
});
Object.defineProperty(this, "name", {
Object.defineProperty(this, "version", {
enumerable: true,
configurable: true,
writable: true,
value: 'BaseError'
value: `ox@${getVersion()}`
});
this.details = details;
this.docs = docs;
this.docsPath = docsPath;
this.metaMessages = args.metaMessages;
this.name = args.name ?? this.name;
this.shortMessage = shortMessage;
this.version = version;
}

@@ -101,0 +77,0 @@ walk(fn) {

import { BaseError } from './base.js';
export type NegativeOffsetErrorType = NegativeOffsetError & {
name: 'NegativeOffsetError';
};
export declare class NegativeOffsetError extends BaseError {
readonly name = "NegativeOffsetError";
constructor({ offset }: {

@@ -10,6 +8,4 @@ offset: number;

}
export type PositionOutOfBoundsErrorType = PositionOutOfBoundsError & {
name: 'PositionOutOfBoundsError';
};
export declare class PositionOutOfBoundsError extends BaseError {
readonly name = "PositionOutOfBoundsError";
constructor({ length, position }: {

@@ -20,6 +16,4 @@ length: number;

}
export type RecursiveReadLimitExceededErrorType = RecursiveReadLimitExceededError & {
name: 'RecursiveReadLimitExceededError';
};
export declare class RecursiveReadLimitExceededError extends BaseError {
readonly name = "RecursiveReadLimitExceededError";
constructor({ count, limit }: {

@@ -26,0 +20,0 @@ count: number;

import { BaseError } from './base.js';
export class NegativeOffsetError extends BaseError {
constructor({ offset }) {
super(`Offset \`${offset}\` cannot be negative.`, {
name: 'NegativeOffsetError',
super(`Offset \`${offset}\` cannot be negative.`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'NegativeOffsetError'
});

@@ -11,4 +15,8 @@ }

constructor({ length, position }) {
super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, {
name: 'PositionOutOfBoundsError',
super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'PositionOutOfBoundsError'
});

@@ -19,4 +27,8 @@ }

constructor({ count, limit }) {
super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, {
name: 'RecursiveReadLimitExceededError',
super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`);
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'RecursiveReadLimitExceededError'
});

@@ -23,0 +35,0 @@ }

import type { Bytes, Hex } from '../types/data.js';
import { BaseError } from './base.js';
export type IntegerOutOfRangeErrorType = IntegerOutOfRangeError & {
name: 'IntegerOutOfRangeError';
};
export declare class IntegerOutOfRangeError extends BaseError {
readonly name = "IntegerOutOfRangeError";
constructor({ max, min, signed, size, value, }: {

@@ -15,30 +13,32 @@ max?: string | undefined;

}
export type InvalidBytesBooleanErrorType = InvalidBytesBooleanError & {
name: 'InvalidBytesBooleanError';
};
export declare class InvalidBytesBooleanError extends BaseError {
readonly name = "InvalidBytesBooleanError";
constructor(bytes: Bytes);
}
export type InvalidHexBooleanErrorType = InvalidHexBooleanError & {
name: 'InvalidHexBooleanError';
};
export declare class InvalidHexBooleanError extends BaseError {
readonly name = "InvalidHexBooleanError";
constructor(hex: Hex);
}
export type InvalidHexValueErrorType = InvalidHexValueError & {
name: 'InvalidHexValueError';
};
export declare class InvalidHexValueError extends BaseError {
export declare class InvalidBytesTypeError extends BaseError {
readonly name = "InvalidBytesTypeError";
constructor(value: unknown);
}
export declare class InvalidHexLengthError extends BaseError {
readonly name = "InvalidHexLengthError";
constructor(value: Hex);
}
export type InvalidTypeErrorType = InvalidTypeError & {
name: 'InvalidTypeError';
};
export declare class InvalidHexTypeError extends BaseError {
readonly name = "InvalidHexTypeError";
constructor(value: unknown);
}
export declare class InvalidHexValueError extends BaseError {
readonly name = "InvalidHexValueError";
constructor(value: unknown);
}
export declare class InvalidTypeError extends BaseError {
constructor(type: string);
readonly name = "InvalidTypeError";
constructor(type: string, expected: string);
}
export type SizeOverflowErrorType = SizeOverflowError & {
name: 'SizeOverflowError';
};
export declare class SizeOverflowError extends BaseError {
readonly name = "SizeOverflowError";
constructor({ givenSize, maxSize }: {

@@ -49,6 +49,4 @@ givenSize: number;

}
export type SliceOffsetOutOfBoundsErrorType = SliceOffsetOutOfBoundsError & {
name: 'SliceOffsetOutOfBoundsError';
};
export declare class SliceOffsetOutOfBoundsError extends BaseError {
readonly name = "SliceOffsetOutOfBoundsError";
constructor({ offset, position, size, }: {

@@ -60,6 +58,4 @@ offset: number;

}
export type SizeExceedsPaddingSizeErrorType = SizeExceedsPaddingSizeError & {
name: 'SizeExceedsPaddingSizeError';
};
export declare class SizeExceedsPaddingSizeError extends BaseError {
readonly name = "SizeExceedsPaddingSizeError";
constructor({ size, targetSize, type, }: {

@@ -66,0 +62,0 @@ size: number;

import { BaseError } from './base.js';
export class IntegerOutOfRangeError extends BaseError {
constructor({ max, min, signed, size, value, }) {
super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' });
super(`Number \`${value}\` is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`, {
docsPath: '/errors#integeroutofrangeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'IntegerOutOfRangeError'
});
}

@@ -9,5 +17,11 @@ }

constructor(bytes) {
super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
name: 'InvalidBytesBooleanError',
super(`Bytes value \`${bytes}\` is not a valid boolean. The bytes array must contain a single byte of either a \`0\` or \`1\` value.`, {
docsPath: '/errors#invalidbytesbooleanerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidBytesBooleanError'
});
}

@@ -17,15 +31,80 @@ }

constructor(hex) {
super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: 'InvalidHexBooleanError' });
super(`Hex value \`"${hex}"\` is not a valid boolean. The hex value must be \`"0x0"\` (false) or \`"0x1"\` (true).`, {
docsPath: '/errors#invalidhexbooleanerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexBooleanError'
});
}
}
export class InvalidBytesTypeError extends BaseError {
constructor(value) {
super(
// TODO: use `stringify` always.
`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value. Bytes values must be of type \`Bytes\`.`, {
docsPath: '/errors#invalidbytestypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidBytesTypeError'
});
}
}
export class InvalidHexLengthError extends BaseError {
constructor(value) {
super(`Hex value \`"${value}"\` is an odd length (${value.length - 2} nibbles). It must be an even length.`, {
docsPath: '/errors#invalidhexlengtherror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexLengthError'
});
}
}
export class InvalidHexTypeError extends BaseError {
constructor(value) {
super(
// TODO: use `stringify` always.
`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type. Hex types must be represented as \`"0x$\{string}"\`.`, {
docsPath: '/errors#invalidhextypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexTypeError'
});
}
}
export class InvalidHexValueError extends BaseError {
constructor(value) {
super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, {
name: 'InvalidHexValueError',
super(`Value \`${value}\` is an invalid hex value. Hex values must start with "0x" and contain only hexadecimal characters (0-9, a-f, A-F).`, {
docsPath: '/errors#invalidhexvalueerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidHexValueError'
});
}
}
export class InvalidTypeError extends BaseError {
constructor(type) {
super(`Type "${type}" is invalid.`, { name: 'InvalidTypeError' });
constructor(type, expected) {
super(`Type \`${type}\` is invalid. Expected: \`${expected}\``, {
docsPath: '/errors#invalidtypeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'InvalidTypeError'
});
}

@@ -35,5 +114,11 @@ }

constructor({ givenSize, maxSize }) {
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, {
name: 'SizeOverflowError',
super(`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`, {
docsPath: '/errors#sizeoverflowerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SizeOverflowError'
});
}

@@ -43,3 +128,11 @@ }

constructor({ offset, position, size, }) {
super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset "${offset}" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' });
super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset \`${offset}\` is out-of-bounds (size: \`${size}\`).`, {
docsPath: '/errors#sliceoffsetoutofboundserror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SliceOffsetOutOfBoundsError'
});
}

@@ -51,5 +144,13 @@ }

.slice(1)
.toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' });
.toLowerCase()} size (\`${size}\`) exceeds padding size (\`${targetSize}\`).`, {
docsPath: '/errors#sizeexceedspaddingsizeerror',
});
Object.defineProperty(this, "name", {
enumerable: true,
configurable: true,
writable: true,
value: 'SizeExceedsPaddingSizeError'
});
}
}
//# sourceMappingURL=data.js.map
import { hexToBytes } from '../bytes/toBytes.js';
import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { type InvalidHexBooleanErrorType, type InvalidTypeErrorType } from '../errors/data.js';
import { InvalidHexBooleanError, InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -14,3 +14,3 @@ import type { Bytes, Hex } from '../types/data.js';

type ReturnType<to> = (to extends 'string' ? string : never) | (to extends 'bytes' ? Bytes : never) | (to extends 'bigint' ? bigint : never) | (to extends 'number' ? number : never) | (to extends 'boolean' ? boolean : never);
type ErrorType = hexToNumber.ErrorType | hexToBigInt.ErrorType | hexToBoolean.ErrorType | hexToString.ErrorType | hexToBytes.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = hexToNumber.ErrorType | hexToBigInt.ErrorType | hexToBoolean.ErrorType | hexToString.ErrorType | hexToBytes.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -70,3 +70,3 @@ /**

};
type ErrorType = assertSize.ErrorType | trimLeft.ErrorType | InvalidHexBooleanErrorType | ErrorType_;
type ErrorType = assertSize.ErrorType | trimLeft.ErrorType | InvalidHexBooleanError | ErrorType_;
}

@@ -73,0 +73,0 @@ /**

import { hexToBytes } from '../bytes/toBytes.js';
import { assertSize } from '../data/assertSize.js';
import { trimLeft, trimRight } from '../data/trim.js';
import { InvalidHexBooleanError, InvalidTypeError, } from '../errors/data.js';
import { InvalidHexBooleanError, InvalidTypeError } from '../errors/data.js';
/**

@@ -38,3 +38,3 @@ * Decodes a {@link Hex} value into a string, number, bigint, boolean, or {@link Bytes}.

return hexToBytes(hex, options);
throw new InvalidTypeError(to);
throw new InvalidTypeError(to, 'string | bytes | bigint | number | boolean');
}

@@ -41,0 +41,0 @@ /**

import { assertSize } from '../data/assertSize.js';
import { isHex } from '../data/isHex.js';
import { padLeft, padRight } from '../data/pad.js';
import { type IntegerOutOfRangeErrorType, type InvalidTypeErrorType } from '../errors/data.js';
import { IntegerOutOfRangeError, InvalidTypeError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -12,3 +12,3 @@ import type { Bytes, Hex } from '../types/data.js';

};
type ErrorType = booleanToHex.ErrorType | bytesToHex.ErrorType | numberToHex.ErrorType | stringToHex.ErrorType | isHex.ErrorType | InvalidTypeErrorType | ErrorType_;
type ErrorType = booleanToHex.ErrorType | bytesToHex.ErrorType | numberToHex.ErrorType | stringToHex.ErrorType | isHex.ErrorType | InvalidTypeError | ErrorType_;
}

@@ -103,3 +103,3 @@ /**

};
type ErrorType = IntegerOutOfRangeErrorType | padLeft.ErrorType | ErrorType_;
type ErrorType = IntegerOutOfRangeError | padLeft.ErrorType | ErrorType_;
}

@@ -106,0 +106,0 @@ /**

@@ -5,3 +5,3 @@ import { assertSize } from '../data/assertSize.js';

import { padLeft, padRight } from '../data/pad.js';
import { IntegerOutOfRangeError, InvalidTypeError, } from '../errors/data.js';
import { IntegerOutOfRangeError, InvalidTypeError } from '../errors/data.js';
const hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0'));

@@ -41,3 +41,3 @@ /**

return booleanToHex(value, options);
throw new InvalidTypeError(typeof value);
throw new InvalidTypeError(typeof value, 'string | number | bigint | boolean | Bytes | readonly number[]');
}

@@ -65,3 +65,3 @@ /**

export function booleanToHex(value, options = {}) {
const hex = `0x${Number(value)}`;
const hex = `0x0${Number(value)}`;
if (typeof options.size === 'number') {

@@ -143,5 +143,4 @@ assertSize(hex, options.size);

}
const hex = `0x${(signed && value < 0
? (1n << BigInt(size * 8)) + BigInt(value)
: value).toString(16)}`;
const stringValue = (signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16);
const hex = `0x${stringValue.length % 2 === 0 ? stringValue : `0${stringValue}`}`;
if (size)

@@ -148,0 +147,0 @@ return padLeft(hex, size);

import { hexToBytes } from '../bytes/toBytes.js';
import { type Cursor, createCursor } from '../cursor.js';
import { type BaseErrorType } from '../errors/base.js';
import { type InvalidHexValueErrorType } from '../errors/data.js';
import { InvalidHexLengthError } from '../errors/data.js';
import type { ErrorType as ErrorType_ } from '../errors/error.js';

@@ -12,3 +12,3 @@ import { bytesToHex } from '../hex/toHex.js';

type ReturnType<to extends To> = (to extends 'bytes' ? RecursiveArray<Bytes> : never) | (to extends 'hex' ? RecursiveArray<Hex> : never);
type ErrorType = hexToBytes.ErrorType | fromRlpCursor.ErrorType | createCursor.ErrorType | InvalidHexValueErrorType | ErrorType_;
type ErrorType = hexToBytes.ErrorType | fromRlpCursor.ErrorType | createCursor.ErrorType | InvalidHexLengthError | ErrorType_;
}

@@ -15,0 +15,0 @@ /**

import { hexToBytes } from '../bytes/toBytes.js';
import { createCursor } from '../cursor.js';
import { BaseError } from '../errors/base.js';
import { InvalidHexValueError, } from '../errors/data.js';
import { InvalidHexLengthError } from '../errors/data.js';
import { bytesToHex } from '../hex/toHex.js';

@@ -21,3 +21,3 @@ /**

if (value.length > 3 && value.length % 2 !== 0)
throw new InvalidHexValueError(value);
throw new InvalidHexLengthError(value);
return hexToBytes(value);

@@ -24,0 +24,0 @@ }

/** @internal */
export declare const version = "0.0.0-20240815T061458";
export declare const version = "0.0.0-20240816T000930";
//# sourceMappingURL=version.d.ts.map
/** @internal */
export const version = '0.0.0-20240815T061458';
export const version = '0.0.0-20240816T000930';
//# sourceMappingURL=version.js.map

@@ -0,1 +1,3 @@

export { assertBytes, assertBytes as assert } from './internal/bytes/assert.js'
export { concat } from './internal/data/concat.js'

@@ -2,0 +4,0 @@

export {
BaseError,
type BaseErrorType,
setErrorConfig,
} from './internal/errors/base.js'

@@ -9,7 +8,4 @@

NegativeOffsetError,
type NegativeOffsetErrorType,
PositionOutOfBoundsError,
type PositionOutOfBoundsErrorType,
RecursiveReadLimitExceededError,
type RecursiveReadLimitExceededErrorType,
} from './internal/errors/cursor.js'

@@ -19,19 +15,11 @@

IntegerOutOfRangeError,
type IntegerOutOfRangeErrorType,
InvalidBytesBooleanError,
type InvalidBytesBooleanErrorType,
InvalidHexBooleanError,
type InvalidHexBooleanErrorType,
InvalidHexValueError,
type InvalidHexValueErrorType,
InvalidHexLengthError,
InvalidTypeError,
type InvalidTypeErrorType,
SizeExceedsPaddingSizeError,
type SizeExceedsPaddingSizeErrorType,
SizeOverflowError,
type SizeOverflowErrorType,
SliceOffsetOutOfBoundsError,
type SliceOffsetOutOfBoundsErrorType,
} from './internal/errors/data.js'
export type { ErrorType } from './internal/errors/error.js'

@@ -0,1 +1,3 @@

export { assertHex, assertHex as assert } from './internal/hex/assert.js'
export { concat } from './internal/data/concat.js'

@@ -2,0 +4,0 @@

import { assertSize } from '../data/assertSize.js'
import { trimLeft, trimRight } from '../data/trim.js'
import {
InvalidBytesBooleanError,
InvalidTypeError,
type InvalidTypeErrorType,
} from '../errors/data.js'
import { InvalidBytesBooleanError, InvalidTypeError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -34,3 +30,3 @@ import { hexToBigInt, hexToNumber } from '../hex/fromHex.js'

| bytesToHex.ErrorType
| InvalidTypeErrorType
| InvalidTypeError
| ErrorType_

@@ -74,3 +70,3 @@ }

return bytesToHex(bytes, options) as fromBytes.ReturnType<to>
throw new InvalidTypeError(to)
throw new InvalidTypeError(to, 'string | hex | bigint | number | boolean')
}

@@ -77,0 +73,0 @@

@@ -6,3 +6,3 @@ import { assertSize } from '../data/assertSize.js'

import { BaseError } from '../errors/base.js'
import { InvalidTypeError, type InvalidTypeErrorType } from '../errors/data.js'
import { InvalidHexLengthError, InvalidTypeError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -25,3 +25,3 @@ import { numberToHex } from '../hex/toHex.js'

| isHex.ErrorType
| InvalidTypeErrorType
| InvalidTypeError
| ErrorType_

@@ -61,3 +61,6 @@ }

return numberToBytes(value, options)
throw new InvalidTypeError(typeof value)
throw new InvalidTypeError(
typeof value,
'string | bigint | number | boolean | Bytes | Hex | readonly number[]',
)
}

@@ -155,2 +158,4 @@

if (hex_.length % 2) throw new InvalidHexLengthError(hex_)
let hex = hex_

@@ -162,4 +167,3 @@ if (size) {

let hexString = hex.slice(2) as string
if (hexString.length % 2) hexString = `0${hexString}`
const hexString = hex.slice(2) as string

@@ -166,0 +170,0 @@ const length = hexString.length / 2

import {
NegativeOffsetError,
type NegativeOffsetErrorType,
PositionOutOfBoundsError,
type PositionOutOfBoundsErrorType,
RecursiveReadLimitExceededError,
type RecursiveReadLimitExceededErrorType,
} from './errors/cursor.js'

@@ -53,3 +50,3 @@ import type { ErrorType as ErrorType_ } from './errors/error.js'

type CursorAssertPositionErrorType = PositionOutOfBoundsErrorType | ErrorType_
type CursorAssertPositionErrorType = PositionOutOfBoundsError | ErrorType_

@@ -61,4 +58,4 @@ type CursorDecrementPositionErrorType = NegativeOffsetError | ErrorType_

type StaticCursorErrorType =
| NegativeOffsetErrorType
| RecursiveReadLimitExceededErrorType
| NegativeOffsetError
| RecursiveReadLimitExceededError

@@ -65,0 +62,0 @@ const staticCursor: Cursor = {

@@ -1,5 +0,2 @@

import {
SizeOverflowError,
type SizeOverflowErrorType,
} from '../errors/data.js'
import { SizeOverflowError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -10,3 +7,3 @@ import type { Bytes, Hex } from '../types/data.js'

export declare namespace assertSize {
type ErrorType = size.ErrorType | SizeOverflowErrorType | ErrorType_
type ErrorType = size.ErrorType | SizeOverflowError | ErrorType_
}

@@ -13,0 +10,0 @@

@@ -0,1 +1,2 @@

import { assertBytes } from '../bytes/assert.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -19,8 +20,8 @@ import type { Bytes } from '../types/data.js'

export function isBytes(value: unknown): value is Bytes {
if (!value) return false
if (typeof value !== 'object') return false
if (!('BYTES_PER_ELEMENT' in value)) return false
return (
value.BYTES_PER_ELEMENT === 1 && value.constructor.name === 'Uint8Array'
)
try {
assertBytes(value)
return true
} catch {
return false
}
}
import type { ErrorType as ErrorType_ } from '../errors/error.js'
import { assertHex } from '../hex/assert.js'
import type { Hex } from '../types/data.js'

@@ -27,5 +28,8 @@

const { strict = true } = options
if (!value) return false
if (typeof value !== 'string') return false
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x')
try {
assertHex(value, { strict })
return true
} catch {
return false
}
}

@@ -1,5 +0,2 @@

import {
SizeExceedsPaddingSizeError,
type SizeExceedsPaddingSizeErrorType,
} from '../errors/data.js'
import { SizeExceedsPaddingSizeError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -90,3 +87,4 @@ import type { Bytes, Hex } from '../types/data.js'

type Options = pad.Options
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_
}

@@ -111,3 +109,4 @@ function padHex(hex_: Hex, options: padHex.Options = {}) {

type Options = pad.Options
type ErrorType = SizeExceedsPaddingSizeErrorType | ErrorType_
type ErrorType = SizeExceedsPaddingSizeError | ErrorType_
}

@@ -114,0 +113,0 @@ function padBytes(bytes: Bytes, options: padBytes.Options = {}) {

@@ -1,5 +0,2 @@

import {
SliceOffsetOutOfBoundsError,
type SliceOffsetOutOfBoundsErrorType,
} from '../errors/data.js'
import { SliceOffsetOutOfBoundsError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -64,3 +61,3 @@ import type { Bytes, Hex } from '../types/data.js'

declare namespace assertStartOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_
}

@@ -77,3 +74,3 @@ function assertStartOffset(value: Hex | Bytes, start?: number | undefined) {

declare namespace assertEndOffset {
type ErrorType = SliceOffsetOutOfBoundsErrorType | size.ErrorType | ErrorType_
type ErrorType = SliceOffsetOutOfBoundsError | size.ErrorType | ErrorType_
}

@@ -80,0 +77,0 @@ function assertEndOffset(

@@ -1,44 +0,8 @@

import { version } from '../../version.js'
import { getVersion } from './utils.js'
type ErrorConfig = {
getDocsUrl?: ((args: BaseErrorParameters) => string | undefined) | undefined
version?: string | undefined
}
let errorConfig: ErrorConfig = {
getDocsUrl: ({
docsBaseUrl,
docsPath = '',
docsSlug,
}: BaseErrorParameters) =>
docsPath
? `${docsBaseUrl ?? 'https://oxlib.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`
: undefined,
version,
}
/**
* Sets the global error configuration.
*
* @example
* import { Errors } from 'ox'
* Errors.setErrorConfig({
* getDocsUrl({ name }) {
* return `https://mylib.sh/docs/errors?name=${name}`
* },
* version: 'mylib@1.0.0',
* })
*/
export function setErrorConfig(config: ErrorConfig) {
errorConfig = config
}
type BaseErrorParameters = {
cause?: BaseError | Error | undefined
details?: string | undefined
docsBaseUrl?: string | undefined
docsPath?: string | undefined
docsSlug?: string | undefined
metaMessages?: string[] | undefined
name?: string | undefined
}

@@ -57,9 +21,10 @@

details: string
docs?: string | undefined
docsPath?: string | undefined
metaMessages?: string[] | undefined
shortMessage: string
version: string
override name = 'BaseError'
version = `ox@${getVersion()}`
constructor(shortMessage: string, args: BaseErrorParameters = {}) {

@@ -76,12 +41,12 @@ const details = (() => {

})()
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath })
const docsBaseUrl = 'https://oxlib.sh'
const docs = `${docsBaseUrl}${docsPath ?? ''}`
const message = [
shortMessage || 'An error occurred.',
'',
...(args.metaMessages ? [...args.metaMessages, ''] : []),
...(docsUrl ? [`Docs: ${docsUrl}`] : []),
...(details ? [`Details: ${details}`] : []),
...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),
].join('\n')
docsPath && `\nSee: ${docs}`,
]
.filter((x) => typeof x === 'string')
.join('\n')

@@ -91,7 +56,5 @@ super(message, args.cause ? { cause: args.cause } : undefined)

this.details = details
this.docs = docs
this.docsPath = docsPath
this.metaMessages = args.metaMessages
this.name = args.name ?? this.name
this.shortMessage = shortMessage
this.version = version
}

@@ -98,0 +61,0 @@

import { BaseError } from './base.js'
export type NegativeOffsetErrorType = NegativeOffsetError & {
name: 'NegativeOffsetError'
}
export class NegativeOffsetError extends BaseError {
override readonly name = 'NegativeOffsetError'
constructor({ offset }: { offset: number }) {
super(`Offset \`${offset}\` cannot be negative.`, {
name: 'NegativeOffsetError',
})
super(`Offset \`${offset}\` cannot be negative.`)
}
}
export type PositionOutOfBoundsErrorType = PositionOutOfBoundsError & {
name: 'PositionOutOfBoundsError'
}
export class PositionOutOfBoundsError extends BaseError {
override readonly name = 'PositionOutOfBoundsError'
constructor({ length, position }: { length: number; position: number }) {
super(
`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`,
{
name: 'PositionOutOfBoundsError',
},
)

@@ -28,15 +21,10 @@ }

export type RecursiveReadLimitExceededErrorType =
RecursiveReadLimitExceededError & {
name: 'RecursiveReadLimitExceededError'
}
export class RecursiveReadLimitExceededError extends BaseError {
override readonly name = 'RecursiveReadLimitExceededError'
constructor({ count, limit }: { count: number; limit: number }) {
super(
`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`,
{
name: 'RecursiveReadLimitExceededError',
},
)
}
}
import type { Bytes, Hex } from '../types/data.js'
import { BaseError } from './base.js'
export type IntegerOutOfRangeErrorType = IntegerOutOfRangeError & {
name: 'IntegerOutOfRangeError'
}
export class IntegerOutOfRangeError extends BaseError {
override readonly name = 'IntegerOutOfRangeError'
constructor({

@@ -22,6 +21,8 @@ max,

super(
`Number "${value}" is not in safe ${
`Number \`${value}\` is not in safe ${
size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''
}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`,
{ name: 'IntegerOutOfRangeError' },
}integer range ${max ? `(\`${min}\` to \`${max}\`)` : `(above \`${min}\`)`}`,
{
docsPath: '/errors#integeroutofrangeerror',
},
)

@@ -31,11 +32,10 @@ }

export type InvalidBytesBooleanErrorType = InvalidBytesBooleanError & {
name: 'InvalidBytesBooleanError'
}
export class InvalidBytesBooleanError extends BaseError {
override readonly name = 'InvalidBytesBooleanError'
constructor(bytes: Bytes) {
super(
`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,
`Bytes value \`${bytes}\` is not a valid boolean. The bytes array must contain a single byte of either a \`0\` or \`1\` value.`,
{
name: 'InvalidBytesBooleanError',
docsPath: '/errors#invalidbytesbooleanerror',
},

@@ -46,10 +46,11 @@ )

export type InvalidHexBooleanErrorType = InvalidHexBooleanError & {
name: 'InvalidHexBooleanError'
}
export class InvalidHexBooleanError extends BaseError {
override readonly name = 'InvalidHexBooleanError'
constructor(hex: Hex) {
super(
`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,
{ name: 'InvalidHexBooleanError' },
`Hex value \`"${hex}"\` is not a valid boolean. The hex value must be \`"0x0"\` (false) or \`"0x1"\` (true).`,
{
docsPath: '/errors#invalidhexbooleanerror',
},
)

@@ -59,11 +60,24 @@ }

export type InvalidHexValueErrorType = InvalidHexValueError & {
name: 'InvalidHexValueError'
export class InvalidBytesTypeError extends BaseError {
override readonly name = 'InvalidBytesTypeError'
constructor(value: unknown) {
super(
// TODO: use `stringify` always.
`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid Bytes value. Bytes values must be of type \`Bytes\`.`,
{
docsPath: '/errors#invalidbytestypeerror',
},
)
}
}
export class InvalidHexValueError extends BaseError {
export class InvalidHexLengthError extends BaseError {
override readonly name = 'InvalidHexLengthError'
constructor(value: Hex) {
super(
`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`,
`Hex value \`"${value}"\` is an odd length (${value.length - 2} nibbles). It must be an even length.`,
{
name: 'InvalidHexValueError',
docsPath: '/errors#invalidhexlengtherror',
},

@@ -74,20 +88,47 @@ )

export type InvalidTypeErrorType = InvalidTypeError & {
name: 'InvalidTypeError'
export class InvalidHexTypeError extends BaseError {
override readonly name = 'InvalidHexTypeError'
constructor(value: unknown) {
super(
// TODO: use `stringify` always.
`Value \`${typeof value === 'object' ? JSON.stringify(value) : value}\` of type \`${typeof value}\` is an invalid hex type. Hex types must be represented as \`"0x$\{string}"\`.`,
{
docsPath: '/errors#invalidhextypeerror',
},
)
}
}
export class InvalidHexValueError extends BaseError {
override readonly name = 'InvalidHexValueError'
constructor(value: unknown) {
super(
`Value \`${value}\` is an invalid hex value. Hex values must start with "0x" and contain only hexadecimal characters (0-9, a-f, A-F).`,
{
docsPath: '/errors#invalidhexvalueerror',
},
)
}
}
export class InvalidTypeError extends BaseError {
constructor(type: string) {
super(`Type "${type}" is invalid.`, { name: 'InvalidTypeError' })
override readonly name = 'InvalidTypeError'
constructor(type: string, expected: string) {
super(`Type \`${type}\` is invalid. Expected: \`${expected}\``, {
docsPath: '/errors#invalidtypeerror',
})
}
}
export type SizeOverflowErrorType = SizeOverflowError & {
name: 'SizeOverflowError'
}
export class SizeOverflowError extends BaseError {
override readonly name = 'SizeOverflowError'
constructor({ givenSize, maxSize }: { givenSize: number; maxSize: number }) {
super(
`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`,
`Size cannot exceed \`${maxSize}\` bytes. Given size: \`${givenSize}\` bytes.`,
{
name: 'SizeOverflowError',
docsPath: '/errors#sizeoverflowerror',
},

@@ -98,6 +139,5 @@ )

export type SliceOffsetOutOfBoundsErrorType = SliceOffsetOutOfBoundsError & {
name: 'SliceOffsetOutOfBoundsError'
}
export class SliceOffsetOutOfBoundsError extends BaseError {
override readonly name = 'SliceOffsetOutOfBoundsError'
constructor({

@@ -111,4 +151,6 @@ offset,

position === 'start' ? 'starting' : 'ending'
} at offset "${offset}" is out-of-bounds (size: ${size}).`,
{ name: 'SliceOffsetOutOfBoundsError' },
} at offset \`${offset}\` is out-of-bounds (size: \`${size}\`).`,
{
docsPath: '/errors#sliceoffsetoutofboundserror',
},
)

@@ -118,6 +160,5 @@ }

export type SizeExceedsPaddingSizeErrorType = SizeExceedsPaddingSizeError & {
name: 'SizeExceedsPaddingSizeError'
}
export class SizeExceedsPaddingSizeError extends BaseError {
override readonly name = 'SizeExceedsPaddingSizeError'
constructor({

@@ -135,6 +176,8 @@ size,

.slice(1)
.toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`,
{ name: 'SizeExceedsPaddingSizeError' },
.toLowerCase()} size (\`${size}\`) exceeds padding size (\`${targetSize}\`).`,
{
docsPath: '/errors#sizeexceedspaddingsizeerror',
},
)
}
}
import { hexToBytes } from '../bytes/toBytes.js'
import { assertSize } from '../data/assertSize.js'
import { trimLeft, trimRight } from '../data/trim.js'
import {
InvalidHexBooleanError,
type InvalidHexBooleanErrorType,
InvalidTypeError,
type InvalidTypeErrorType,
} from '../errors/data.js'
import { InvalidHexBooleanError, InvalidTypeError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -34,3 +29,3 @@ import type { Bytes, Hex } from '../types/data.js'

| hexToBytes.ErrorType
| InvalidTypeErrorType
| InvalidTypeError
| ErrorType_

@@ -75,3 +70,3 @@ }

if (to === 'bytes') return hexToBytes(hex, options) as fromHex.ReturnType<to>
throw new InvalidTypeError(to)
throw new InvalidTypeError(to, 'string | bytes | bigint | number | boolean')
}

@@ -132,3 +127,3 @@

| trimLeft.ErrorType
| InvalidHexBooleanErrorType
| InvalidHexBooleanError
| ErrorType_

@@ -135,0 +130,0 @@ }

@@ -5,8 +5,3 @@ import { assertSize } from '../data/assertSize.js'

import { padLeft, padRight } from '../data/pad.js'
import {
IntegerOutOfRangeError,
type IntegerOutOfRangeErrorType,
InvalidTypeError,
type InvalidTypeErrorType,
} from '../errors/data.js'
import { IntegerOutOfRangeError, InvalidTypeError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -31,3 +26,3 @@ import type { Bytes, Hex } from '../types/data.js'

| isHex.ErrorType
| InvalidTypeErrorType
| InvalidTypeError
| ErrorType_

@@ -67,3 +62,6 @@ }

if (typeof value === 'boolean') return booleanToHex(value, options)
throw new InvalidTypeError(typeof value)
throw new InvalidTypeError(
typeof value,
'string | number | bigint | boolean | Bytes | readonly number[]',
)
}

@@ -104,3 +102,3 @@

): Hex {
const hex: Hex = `0x${Number(value)}`
const hex: Hex = `0x0${Number(value)}`
if (typeof options.size === 'number') {

@@ -171,3 +169,3 @@ assertSize(hex, options.size)

type ErrorType = IntegerOutOfRangeErrorType | padLeft.ErrorType | ErrorType_
type ErrorType = IntegerOutOfRangeError | padLeft.ErrorType | ErrorType_
}

@@ -219,6 +217,8 @@

const hex = `0x${(signed && value < 0
? (1n << BigInt(size * 8)) + BigInt(value)
: value
).toString(16)}` as Hex
const stringValue = (
signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value
).toString(16)
const hex =
`0x${stringValue.length % 2 === 0 ? stringValue : `0${stringValue}`}` as Hex
if (size) return padLeft(hex, size) as Hex

@@ -225,0 +225,0 @@ return hex

import { hexToBytes } from '../bytes/toBytes.js'
import { type Cursor, createCursor } from '../cursor.js'
import { BaseError, type BaseErrorType } from '../errors/base.js'
import {
InvalidHexValueError,
type InvalidHexValueErrorType,
} from '../errors/data.js'
import { InvalidHexLengthError } from '../errors/data.js'
import type { ErrorType as ErrorType_ } from '../errors/error.js'

@@ -24,3 +21,3 @@ import { bytesToHex } from '../hex/toHex.js'

| createCursor.ErrorType
| InvalidHexValueErrorType
| InvalidHexLengthError
| ErrorType_

@@ -48,3 +45,3 @@ }

if (value.length > 3 && value.length % 2 !== 0)
throw new InvalidHexValueError(value)
throw new InvalidHexLengthError(value)
return hexToBytes(value)

@@ -51,0 +48,0 @@ }

{
"name": "ox",
"description": "Ethereum Standard Library",
"version": "0.0.0-20240815T061458",
"version": "0.0.0-20240816T000930",
"main": "./_cjs/index.js",

@@ -6,0 +6,0 @@ "module": "./_esm/index.js",

/** @internal */
export const version = '0.0.0-20240815T061458'
export const version = '0.0.0-20240816T000930'

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

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