1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var tslib_1 = require("tslib");
|
4 | var isFunction = require("lodash/isFunction");
|
5 | var Applicator_1 = require("./Applicator");
|
6 | var utils_1 = require("../utils");
|
7 | var PartialValueApplicator = (function (_super) {
|
8 | tslib_1.__extends(PartialValueApplicator, _super);
|
9 | function PartialValueApplicator() {
|
10 | return _super !== null && _super.apply(this, arguments) || this;
|
11 | }
|
12 | PartialValueApplicator.prototype.apply = function (_a) {
|
13 | var args = _a.args, target = _a.target, value = _a.value, execute = _a.config.execute;
|
14 | return function () {
|
15 | var invokeArgs = [];
|
16 | for (var _i = 0; _i < arguments.length; _i++) {
|
17 | invokeArgs[_i] = arguments[_i];
|
18 | }
|
19 | var fn = value;
|
20 | var argIndex = 0;
|
21 | if (!isFunction(fn)) {
|
22 | fn = utils_1.resolveFunction(args[0], this, target);
|
23 | argIndex = 1;
|
24 | }
|
25 | return execute.apply(void 0, [fn].concat(args.slice(argIndex))).apply(this, invokeArgs);
|
26 | };
|
27 | };
|
28 | return PartialValueApplicator;
|
29 | }(Applicator_1.Applicator));
|
30 | exports.PartialValueApplicator = PartialValueApplicator;
|
31 |
|
\ | No newline at end of file |