compose-k

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
3
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
3 KB
Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by [`chain`](#chain).
1 contributor
Install compose-k as a package?
Copied
npm i @bit/justin-capalbo.ramda.compose-k
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
composeK (
null.null.null.functions:...Function
) : Function

Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.

R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).

Example
//  get :: String -> Object -> Maybe *
      const get = R.curry((propName, obj) => Maybe(obj[propName]))

      //  getStateCode :: Maybe String -> Maybe String
      const getStateCode = R.composeK(
        R.compose(Maybe.of, R.toUpper),
        get('state'),
        get('address'),
        get('user'),
      );
      getStateCode({"user":{"address":{"state":"ny"}}}); //=> Maybe.Just("NY")
      getStateCode({}); //=> Maybe.Nothing()
Argument
null.null.null.functions: ...Function

The functions to compose

Returns
Function

Help and resources