UNPKG

ts-data-forge

Version:

[![npm version](https://img.shields.io/npm/v/ts-data-forge.svg)](https://www.npmjs.com/package/ts-data-forge) [![npm downloads](https://img.shields.io/npm/dm/ts-data-forge.svg)](https://www.npmjs.com/package/ts-data-forge) [![License](https://img.shields.

19 lines 520 B
/** * Wraps a potentially-throwing function in a `TernaryResult`. * * @example * * ```ts * const success = TernaryResult.fromThrowable(() => 1 + 1); * * const failure = TernaryResult.fromThrowable(() => { * throw new Error('boom'); * }); * * assert.deepStrictEqual(success, TernaryResult.ok(2)); * * assert.isTrue(TernaryResult.isErr(failure)); * ``` */ export declare const fromThrowable: <T>(fn: () => T) => TernaryResult<T, Error, never>; //# sourceMappingURL=ternary-result-from-throwable.d.mts.map