This repository has been archived on 2025-05-09. You can view files and clone it, but cannot push or open issues or pull requests.
EvoCalculator/src/client/tools/assignProps.js
2020-09-01 21:14:24 +03:00

15 lines
358 B
JavaScript

function assignProperties(target, ...sources) {
sources.forEach(source => {
Object.defineProperties(
target,
Object.keys(source).reduce((descriptors, key) => {
descriptors[key] = Object.getOwnPropertyDescriptor(source, key);
return descriptors;
}, {})
);
});
return target;
}
export default assignProperties;