2018-04-24 22:39:06 +03:00
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
|
|
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;
|
|
|
|
};
|