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