UNPKG

1.37 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var curryRight = require("lodash/curryRight");
4var factory_1 = require("./factory");
5var applicators_1 = require("./applicators");
6/**
7 * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.
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 _.curryRight.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 * @CurryRight()
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 */
32exports.CurryRight = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(curryRight, new applicators_1.PreValueApplicator(), { bound: true, optionalParams: true }));
33exports.curryRight = exports.CurryRight;
34exports.default = exports.CurryRight;
35//# sourceMappingURL=curryRight.js.map
\No newline at end of file