UNPKG

lodash-decorators

Version:

A collection of decorators using lodash at it's core.

38 lines 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var flowRight = require("lodash/flowRight"); var factory_1 = require("./factory"); var applicators_1 = require("./applicators"); var decorator = factory_1.DecoratorFactory.createInstanceDecorator(new factory_1.DecoratorConfig(flowRight, new applicators_1.ComposeApplicator({ post: false }), { property: true })); /** * Creates a function that returns the result of invoking the given functions with the this binding of the created function, * where each successive invocation is supplied the return value of the previous. * * @example * * class MyClass { * name = 'Ted'; * * @FlowRight(toUpperCase, 'getName') * getUpperCaseName: () => string; * * getName() { * return this.name; * } * } * * const myClass = new MyClass(); * * myClass.getUpperCaseName(); // => 'TED' */ function FlowRight() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return decorator.apply(void 0, fns); } exports.FlowRight = FlowRight; exports.flowRight = FlowRight; exports.default = decorator; //# sourceMappingURL=flowRight.js.map