Codibre/fluent-iterable

View on GitHub
src/recipes/with-index-recipe.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { Ingredient } from './ingredients';

export function withIndexRecipe(map: Ingredient) {
  return function (this: any): any {
    let idx = 0;
    return map.call(this, (t: any) => ({ idx: idx++, value: t }));
  };
}