assoc

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
6
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
940 B
Makes a shallow clone of an object, setting or overriding the specified property with the given value.
1 contributor
Install assoc as a package?
Copied
npm i @bit/justin-capalbo.ramda.assoc
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
assoc (
prop:String,
val:*,
obj:Object
) : Object

Makes a shallow clone of an object, setting or overriding the specified property with the given value. Note that this copies and flattens prototype properties onto the new object as well. All non-primitive properties are copied by reference.

Example
R.assoc('c', 3, {a: 1, b: 2}); //=> {a: 1, b: 2, c: 3}
Arguments
prop: String

The property name to set

val: *

The new value

obj: Object

The object to clone

Returns
Object

A new object equivalent to the original except for the changed property.

Help and resources