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

o

v0.26.1arrow_drop_down
v0.26.1
STATUS
Passing
DOWNLOADS
3
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
8 months ago
SIZE
927 B
`o` is a curried composition function that returns a unary function
1 contributor
Use o in your project ?
Copied
npm i @bit/ramda.ramda.o
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
const classyGreeting = name => 'The name's ' + name.last + ', ' + name.first + ' ' + name.last;
const yellGreeting = o(toUpper, classyGreeting);
modifieddraft
chevron_left
chevron_right
o (
f:Function,
g:Function
) : Function

o is a curried composition function that returns a unary function. Like compose, o performs right-to-left function composition. Unlike compose, the rightmost function passed to o will be invoked with only one argument. Also, unlike compose, o is limited to accepting only 2 unary functions. The name o was chosen because of its similarity to the mathematical composition operator ∘.

Example
const classyGreeting = name => "The name's " + name.last + ", " + name.first + " " + name.last
     const yellGreeting = R.o(R.toUpper, classyGreeting);
     yellGreeting({first: 'James', last: 'Bond'}); //=> "THE NAME'S BOND, JAMES BOND"

     R.o(R.multiply(10), R.add(10))(-4) //=> 60
Arguments
f: Function
g: Function
Returns
Function