Skip to main content
Module

x/ramda/mod.ts>addIndex

:ram: Practical functional Javascript
Latest
variable addIndex
import { addIndex } from "https://deno.land/x/ramda@v0.27.2/mod.ts";

Creates a new list iteration function from an existing one by adding two new parameters to its callback function: the current index, and the entire list.

This would turn, for instance, R.map function into one that more closely resembles Array.prototype.map. Note that this will only work for functions in which the iteration callback function is the first parameter, and where the list is the last parameter. (This latter might be unimportant if the list parameter is not used.)