UNPKG

1.18 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var flowRight = require("lodash/flowRight");
4var factory_1 = require("./factory");
5var applicators_1 = require("./applicators");
6var decorator = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(flowRight, new applicators_1.ComposeApplicator({ post: false }), { property: true }));
7/**
8 * Creates a function that returns the result of invoking the given functions with the this binding of the created function,
9 * where each successive invocation is supplied the return value of the previous.
10 *
11 * @example
12 *
13 * class MyClass {
14 * name = 'Ted';
15 *
16 * @FlowRight(toUpperCase, 'getName')
17 * getUpperCaseName: () => string;
18 *
19 * getName() {
20 * return this.name;
21 * }
22 * }
23 *
24 * const myClass = new MyClass();
25 *
26 * myClass.getUpperCaseName(); // => 'TED'
27 */
28function FlowRight() {
29 var fns = [];
30 for (var _i = 0; _i < arguments.length; _i++) {
31 fns[_i] = arguments[_i];
32 }
33 return decorator.apply(void 0, fns);
34}
35exports.FlowRight = FlowRight;
36exports.flowRight = FlowRight;
37exports.default = decorator;
38//# sourceMappingURL=flowRight.js.map
\No newline at end of file