@xylabs/hex
Version:
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
13 lines • 733 B
TypeScript
import type { AssertConfig } from '@xylabs/error';
import type { Address } from './address.ts';
/**
* Attempts to coerce a value into an Address 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 Address, or undefined if coercion fails and assert is not set
*/
export declare function asAddress(value: unknown): Address | undefined;
export declare function asAddress(value: unknown, assert: AssertConfig): Address;
/** @alpha */
export declare function asAddressV2(value: unknown, assert?: boolean): Address | undefined;
//# sourceMappingURL=as.d.ts.map