Remove lodash.merge with custom merge fucntion, default to "en" language if null

This commit is contained in:
August
2020-09-25 07:07:16 -07:00
parent 9bd4f99006
commit 7e2772812c
3 changed files with 20 additions and 4 deletions

17
src/modules/merge.js Normal file
View 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;
};