UNPKG

1.06 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var overArgs = require("lodash/overArgs");
4var factory_1 = require("./factory");
5var applicators_1 = require("./applicators");
6var decorator = factory_1.DecoratorFactory.createDecorator(new factory_1.DecoratorConfig(overArgs, new applicators_1.PreValueApplicator(), { setter: true }));
7/**
8 * Creates a function that invokes func with its arguments transformed.
9 * @export
10 * @param {...Function[]} transforms
11 * @returns {LodashMethodDecorator}
12 * @example
13 * class MyClass {
14 * @OverArgs(_.castArray)
15 * fn(list) {
16 * return list;
17 * }
18 * }
19 *
20 * const myClass = new MyClass();
21 *
22 * myClass.fn([ 1 ]); //=> [ 1 ];
23 * myClass.fn(1); //=> [ 1 ];
24 */
25function OverArgs() {
26 var transforms = [];
27 for (var _i = 0; _i < arguments.length; _i++) {
28 transforms[_i] = arguments[_i];
29 }
30 return decorator.apply(void 0, transforms);
31}
32exports.OverArgs = OverArgs;
33exports.overArgs = OverArgs;
34exports.default = decorator;
35//# sourceMappingURL=overArgs.js.map
\No newline at end of file