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

merge

v1.0.0arrow_drop_down
v1.0.0
v0.0.1
STATUS
Passing
DOWNLOADS
35
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
2 years ago
SIZE
520 B
Merges multiple objects into one
2 contributors
Use merge in your project ?
Copied
npm i @bit/bit.utils.object.merge
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
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
const o1 = { a: 1 };
const o2 = { b: 2 };
const o3 = { c: 3 };

const obj = merge(o1, o2, o3);
console.log(obj); // { a: 1, b: 2, c: 3 }
console.log(o1);  // { a: 1 } does not mutate objects
modifieddraft
chevron_left
chevron_right
merge ()

Merges multiple objects into one

Example
const o1 = { a: 1 };
const o2 = { b: 2 };
const o3 = { c: 3 };

const obj = merge(o1, o2, o3);
console.log(obj); // { a: 1, b: 2, c: 3 }
console.log(o1);  // { a: 1 } does not mutate objects
Test Summary

merge the merge fucntion should exist

Pass

merge should merge two objects into one

Pass

merge should merge three objects into one

Pass

merge should not mutate the original objects

Pass

merge return empty object if an empty object insterted

Pass

merge return empty object if no arguments inserted

Pass