UNPKG

@consolidados/results

Version:
27 lines (24 loc) 957 B
import { N as None$1, S as Some$1 } from '../option-B_KKIecf.cjs'; export { O as Option } from '../option-B_KKIecf.cjs'; /** * Creates a new `Some` instance, representing an `Option` with a value. * @template T The type of the value contained in the `Some`. * @param value The value to wrap in the `Some` instance. * @returns A `Some` instance containing the given value. * @example * const option = Some(42); * console.log(option.isSome()); // true * console.log(option.unwrap()); // 42 */ declare function Some<T>(value: T): Some$1<T>; /** * Returns the singleton `None` instance, representing an `Option` with no value. * Uses a singleton pattern to reduce memory allocations. * @returns The singleton `None` instance. * @example * const option = None(); * console.log(option.isNone()); // true * console.log(option.unwrap()); // throws Error: "Called unwrap on a None value" */ declare function None(): None$1; export { None, Some };