Home Reference Source Test Repository

buildDocs/flowRight.js

import { flowRight } from 'lodash';
import { DecoratorConfig, DecoratorFactory } from './factory';
import { ComposeApplicator } from './applicators';
/**
 * 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'
 */
export const FlowRight = DecoratorFactory.createInstanceDecorator(new DecoratorConfig(flowRight, new ComposeApplicator({ post: false }), { property: true }));
export { FlowRight as flowRight };
export default FlowRight;