Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

compose-with

v0.26.1arrow_drop_down
v0.26.1
STATUS
Passing
DOWNLOADS
98
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
8 months ago
SIZE
2 KB
Performs right-to-left function composition using transforming function.
1 contributor
Use compose-with in your project ?
Copied
npm i @bit/ramda.ramda.compose-with
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
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';
revert changes
reload
toggle layout
maximize
composeWhileNotNil([
  inc,
  prop("age")
])({
  age: 1
});
modifieddraft
chevron_left
chevron_right
composeWith (
null.null.null.functions:...Function
) : Function

Performs right-to-left function composition using transforming function. The last argument may have any arity; the remaining arguments must be unary.

Note: The result of compose is not automatically curried. Transforming function is not used on the last argument.

Example
const composeWhileNotNil = R.composeWith((f, res) => R.isNil(res) ? res : f(res));

     composeWhileNotNil([R.inc, R.prop('age')])({age: 1}) //=> 2
     composeWhileNotNil([R.inc, R.prop('age')])({}) //=> undefined
Argument
null.null.null.functions: ...Function

The functions to compose

Returns
Function