UNPKG

1.11 kBTypeScriptView Raw
1import { BiTypedMethodDecorator1 } from './factory';
2/**
3 * Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining func arguments, and so on.
4 * The arity of func may be specified if func.length is not sufficient.
5 * The original function is bound to the instance. If the method is needed to call in a different context use `CurryAll`.
6 *
7 * The _.curry.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for provided arguments.
8 *
9 * Note: This method doesn't set the "length" property of curried functions.
10 * @param {number} [arity] The arity of func.
11 * @example
12 *
13 * class MyClass {
14 * multiplier = 2;
15 *
16 * @Curry()
17 * add(a, b) {
18 * return (a + b) * this.multiplier;
19 * }
20 * }
21 *
22 * const myClass = new MyClass();
23 *
24 * const add5 = myClass.add(5);
25 *
26 * add5AndMultiply(10); // => 30
27 */
28export declare const Curry: BiTypedMethodDecorator1<number>;
29export { Curry as curry };
30export default Curry;