mirror of
https://github.com/mue/mue.git
synced 2026-07-07 14:17:09 +02:00
Remove lodash.merge with custom merge fucntion, default to "en" language if null
This commit is contained in:
17
src/modules/merge.js
Normal file
17
src/modules/merge.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Merges 2 objects into a huge one
|
||||
* @template T The original object
|
||||
* @template U The object that is returned
|
||||
* @param {...T} items The objects to merge
|
||||
* @returns {U} The merged object
|
||||
*/
|
||||
export const merge = (...items) => {
|
||||
const obj = {};
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
for (const k in items[i]) {
|
||||
if (!obj.hasOwnProperty(k)) obj[k] = items[i][k];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
Reference in New Issue
Block a user