then

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
4 KB
Returns the result of applying the onSuccess function to the value inside a successfully resolved promise.
1 contributor
Install then as a package?
Copied
npm i @bit/justin-capalbo.ramda.then
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
then (
onSuccess:Function,
p:Promise
) : Promise

Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions.

Example
var makeQuery = (email) => ({ query: { email }});

     //getMemberName :: String -> Promise ({firstName, lastName})
     var getMemberName = R.pipe(
       makeQuery,
       fetchMember,
       R.then(R.pick(['firstName', 'lastName']))
     );
Arguments
onSuccess: Function

The function to apply. Can return a value or a promise of a value.

p: Promise
Returns
Promise

The result of calling `p.then(onSuccess)`

Help and resources