@xylabs/hex
Version:
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
11 lines • 594 B
TypeScript
import type { AssertConfig } from '@xylabs/error';
import type { Hex } from './hex.ts';
/**
* Attempts to coerce a value into a Hex type, returning undefined or throwing based on the assert config.
* @param value - The value to coerce (must be a string)
* @param assert - If provided, throws on failure instead of returning undefined
* @returns The value as Hex, or undefined if coercion fails and assert is not set
*/
export declare function asHex(value: unknown): Hex | undefined;
export declare function asHex(value: unknown, assert: AssertConfig): Hex;
//# sourceMappingURL=as.d.ts.map