Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

webfactory/merge-objects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ThemergeObjects function is a utility for merging multiple objects into a single object, with an option to perform a deep merge. This function is particularly useful for combining configuration settings, state management, or any scenario where you need to consolidate multiple objects while preserving their properties.

Installation

npm install @webfactoryde/merge-objects

Usage

Import themergeObjects function in your module(s) and pass any number of objects:

// your moduleimportmergeObjectsfrom'@webfactoryde/merge-objects';// Shallow merge:constobj1={a:1,b:2};constobj2={b:3,c:4};constresult=mergeObjects(obj1,obj2);console.log(result);// Output: { a: 1, b: 3, c: 4 }// Deep mergeconstobj1={a:1,b:{x:10,y:20}};constobj2={b:{y:30,z:40},c:4};constresult=mergeObjects(true,obj1,obj2);console.log(result);// Output: { a: 1, b: { x: 10, y: 30, z: 40 }, c: 4}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp