evolve

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
869 B
Creates a new object by recursively evolving a shallow copy of `object`, according to the `transformation` functions.
1 contributor
Install evolve as a package?
Copied
npm i @bit/justin-capalbo.ramda.evolve
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
evolve (
transformations:Object,
object:Object
) : Object

Creates a new object by recursively evolving a shallow copy of object, according to the transformation functions. All non-primitive properties are copied by reference.

A transformation function will not be invoked if its corresponding key does not exist in the evolved object.

Example
const tomato = {firstName: '  Tomato ', data: {elapsed: 100, remaining: 1400}, id:123};
     const transformations = {
       firstName: R.trim,
       lastName: R.trim, // Will not get invoked.
       data: {elapsed: R.add(1), remaining: R.add(-1)}
     };
     R.evolve(transformations, tomato); //=> {firstName: 'Tomato', data: {elapsed: 101, remaining: 1399}, id:123}
Arguments
transformations: Object

The object specifying transformation functions to apply to the object.

object: Object

The object to be transformed.

Returns
Object

The transformed object.

Help and resources