UNPKG

1.38 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var curry = require("lodash/curry");
4var factory_1 = require("./factory");
5var applicators_1 = require("./applicators");
6/**
7 * 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.
8 * The arity of func may be specified if func.length is not sufficient.
9 *
10 * The _.curry.placeholder value, which defaults to _ in monolithic builds, may be used as a placeholder for provided arguments.
11 *
12 * Note: This method doesn't set the "length" property of curried functions.
13 * Note: The original function invoked will not be called in the context of the instance. Use `Curry` to for using it bound.
14 * @param {number} [arity] The arity of func.
15 * @example
16 *
17 * class MyClass {
18 * @CurryAll()
19 * add(a, b) {
20 * return (a + b);
21 * }
22 * }
23 *
24 * const myClass = new MyClass();
25 *
26 * const add5 = myClass.add(5);
27 *
28 * add5AndMultiply(10); // => 15
29 */
30exports.CurryAll = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(curry, new applicators_1.PreValueApplicator(), { optionalParams: true }));
31exports.curryAll = exports.CurryAll;
32exports.default = exports.CurryAll;
33//# sourceMappingURL=curryAll.js.map
\No newline at end of file