Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 685 Bytes

chain.md

File metadata and controls

20 lines (16 loc) · 685 Bytes

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.

@func @memberOf R @since v0.3.0 @category List @sig Chain m => (a -> m b) -> m a -> m b @param {Function} fn The function to map with @param {Array} list The list to map over @return {Array} The result of flat-mapping list with fn @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]