Codibre/fluent-iterable

View on GitHub
src/recipes/execute-recipe.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { AnyIterable } from 'augmentative-iterable';
import { FunctionAnyMapper } from '../types-internal';
import { BasicIngredients } from './ingredients';

export function executeRecipe({ map, resolver }: BasicIngredients) {
  return function <T>(this: AnyIterable<T>, action: FunctionAnyMapper<T>) {
    return map.call(this, (x) => resolver(action(x), () => x));
  };
}