1 contributor
Like
Install add-index as a package?
Copied
npm i @bit/justin-capalbo.ramda.add-index
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example modifieddraft
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
and packages in Bit or NPM to the example. any of the 1 million componentstoggle layout
No preview available
chevron_left
chevron_right
addIndex (
fn:
) : Function
Function
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.)
Example
Argument
fn:
Function
A list iteration function that does not pass index or list to its callback
Returns
Function
An altered list iteration function that passes (item, index, list) to its callback