2018-04-24 22:39:06 +03:00
|
|
|
export const extendProperties = function extendProperties(dest, src) {
|
|
|
|
/* Version of _.extend that works with property descriptors */
|
|
|
|
if (dest !== src) {
|
|
|
|
for (const key in src) {
|
2018-11-05 17:14:02 +03:00
|
|
|
if (!Object.prototype.hasOwnProperty.call(src, key)) {
|
2018-04-24 22:39:06 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
const descriptor = Object.getOwnPropertyDescriptor(src, key);
|
|
|
|
if (descriptor && descriptor.get) {
|
|
|
|
Object.defineProperty(dest, key, {
|
|
|
|
get: descriptor.get,
|
|
|
|
set: descriptor.set,
|
|
|
|
enumerable: descriptor.enumerable,
|
2018-06-14 03:20:43 +03:00
|
|
|
configurable: descriptor.configurable,
|
2018-04-24 22:39:06 +03:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
dest[key] = src[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dest;
|
|
|
|
};
|
2019-05-23 02:59:35 +03:00
|
|
|
|
|
|
|
export const didObjectsChange = (firstObj, secondObj, fields) =>
|
2020-04-30 22:40:38 +03:00
|
|
|
fields.some((field) => firstObj[field] !== secondObj[field]);
|