swc/packages/swc-helpers/src/_object_spread.mjs

19 lines
702 B
JavaScript
Raw Normal View History

import _define_property from "./_define_property.mjs";
export default function _object_spread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === "function") {
ownKeys = ownKeys.concat(
Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
})
);
}
ownKeys.forEach(function(key) {
_define_property(target, key, source[key]);
});
2021-12-05 09:46:09 +03:00
}
return target;
}