Share your code. Components are building blocks, you are the architect.

utils/map-accum-right
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
1     DEPENDENCIES
Build: fail
BuildFail
Build Status: fail
The `mapAccumRight` function behaves like a combination of map and reduce; it

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/map-accum-right in your project
npm i @bit/bit.ramda.utils.map-accum-right
Copied

mapAccumRight (fn:Function, acc:*, list:Array) : *

The mapAccumRight function behaves like a combination of map and reduce; it applies a function to each element of a list, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new list.

Similar to mapAccum, except moves through the input list from the right to the left.

The iterator function receives two arguments, acc and value, and should return a tuple [acc, value].

Example

var digits = ['1', '2', '3', '4'];
     var appender = (a, b) => [b + a, b + a];

     R.mapAccumRight(appender, 5, digits); //=> ['12345', ['12345', '2345', '345', '45']]

Arguments

fn: Function

The function to be called on every element of the input `list`.

acc: *

The accumulator value.

list: Array

The list to iterate over.

Returns

*

The final, accumulated value.