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

utils/chain
v1.1.0
1.1.0
1.0.0
`chain` maps a function over a list and concatenates the results

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/chain in your project
npm i @bit/bit.ramda.utils.chain
Copied

chain (fn:Function, list:Array) : Array

chain maps a function over a list and concatenates the results. chain is also known as flatMap in some libraries

Dispatches to the chain method of the second argument, if present, according to the FantasyLand Chain spec.

Acts as a transducer if a transformer is given in list position.

Example

var duplicate = n => [n, n];
     R.chain(duplicate, [1, 2, 3]); //=> [1, 1, 2, 2, 3, 3]

     R.chain(R.append, R.head)([1, 2, 3]); //=> [1, 2, 3, 1]

Arguments

fn: Function

The function to map with

list: Array

The list to map over

Returns

Array

The result of flat-mapping `list` with `fn`