UNPKG

658 BTypeScriptView Raw
1import { BiTypedMethodDecorator } from './factory';
2/**
3 * Attempts to invoke func, returning either the result or the caught error object. Any additional arguments are provided to func when it's invoked.
4 * @param {...*} [args] The arguments to invoke func with.
5 * @example
6 *
7 * class MyClass {
8 * @Attempt()
9 * fn(value) {
10 * if (typeof value === 'number') {
11 * return value
12 * }
13 *
14 * throw new Error();
15 * }
16 * }
17 *
18 * const myClass = new MyClass();
19 *
20 * myClass.fn(10); // => 10;
21 * myClass.fn(null); // => Error
22 */
23export declare const Attempt: BiTypedMethodDecorator;
24export { Attempt as attempt };
25export default Attempt;