UNPKG

@ngrx/core

Version:

Core operators and utiliies for the ngrx platform

16 lines (15 loc) 470 B
"use strict"; exports.compose = function () { var functions = []; for (var _i = 0; _i < arguments.length; _i++) { functions[_i - 0] = arguments[_i]; } return function (arg) { if (functions.length === 0) { return arg; } var last = functions[functions.length - 1]; var rest = functions.slice(0, -1); return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg)); }; };