const {
merge,
cloneDeep,
isPlainObject,
defaultsDeep,
mergeWith,
difference,
keys,
omit
} = _;
const getType = val => Object.prototype.toString.call(val);
const customizer = (objValue, srcValue) => {
if (isPlainObject(srcValue) && isPlainObject(objValue)) {
return defaultsDeep(objValue, srcValue);
}
else if (getType(objValue) === getType(srcValue)) {
return objValue;
}
else {
return srcValue;
}
};
const oldObj = { border: {borderWidth: 1, posi: 11}, 'b': [2], fonta: 1};
const newObj = {border: {borderWidth: 4, borderColor: 'red'}, 'b': [4], fontSize: 1213};
const needKeys = keys(newObj);
const result = mergeWith(oldObj, newObj, customizer);
const newKeys = keys(result);
console.log(difference(needKeys, newKeys));
const data = omit(result, difference(newKeys, needKeys));
console.log(data);
console