Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function overrideObject(objOld, objNew) {
- var objCurrent = Object.assign({}, objOld);
- for (var i in objOld) {
- if (typeof objNew[i] === 'undefined')
- continue;
- else if (typeof objCurrent[i] === 'object' && typeof objNew[i] === 'object')
- objCurrent[i] = overrideObject(objCurrent[i], objNew[i]);
- else
- objCurrent[i] = objNew[i];
- }
- return objCurrent;
- }
Add Comment
Please, Sign In to add comment