import isEqual from './equals'; export default function getModifiedData(object, objectOld) { var newObject = {}; if (objectOld === null) { return object; } for (var k in object) { var val = object[k]; var valOld = objectOld[k] === undefined ? null : objectOld[k]; if (!isEqual(val, valOld)) { if (val instanceof Object) { newObject[k] = getModifiedData(val, valOld); } else { newObject[k] = val; } } } return Object.keys(newObject).length ? newObject : undefined; }