UNPKG

@codibre/fluent-iterable

Version:

Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).

22 lines (21 loc) 832 B
"use strict"; /* eslint-disable guard-for-in */ Object.defineProperty(exports, "__esModule", { value: true }); exports.mountIterableFunctions = mountIterableFunctions; const transform_obj_values_1 = require("../transform-obj-values"); const getDefinition = (iterableFunc, wrapper, force) => { return force ? function (...args) { return wrapper(iterableFunc.call(this, ...args)); } : function (...args) { const result = iterableFunc.call(this, ...args); return wrapper(result); }; }; function getValue(wrapper, force) { return ([_p, func]) => getDefinition(func, wrapper, force); } function mountIterableFunctions(iterableFuncs, wrapper, force = false) { return (0, transform_obj_values_1.transformObjValues)(iterableFuncs, getValue(wrapper, force)); }