converge

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
4
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
3 KB
Accepts a converging function and a list of branching functions and returns a new function.
1 contributor
Install converge as a package?
Copied
npm i @bit/justin-capalbo.ramda.converge
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
converge (
after:Function,
functions:Array
) : Function

Accepts a converging function and a list of branching functions and returns a new function. The arity of the new function is the same as the arity of the longest branching function. When invoked, this new function is applied to some arguments, and each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value.

Example
const average = R.converge(R.divide, [R.sum, R.length])
     average([1, 2, 3, 4, 5, 6, 7]) //=> 4

     const strangeConcat = R.converge(R.concat, [R.toUpper, R.toLower])
     strangeConcat("Yodel") //=> "YODELyodel"
Arguments
after: Function

A function. after will be invoked with the return values of fn1 and fn2 as its arguments.

functions: Array

A list of functions.

Returns
Function

A new function.

Help and resources