mirror of
https://github.com/swc-project/swc.git
synced 2024-11-24 10:12:42 +03:00
a13a78e3fe
**BREAKING CHANGE:** Breaking changes for `@swc/helpers`. A new major version `0.5.0` is required. **Related issue:** - Closes https://github.com/swc-project/swc/issues/7157
29 lines
890 B
JavaScript
29 lines
890 B
JavaScript
function ownKeys(object, enumerableOnly) {
|
|
var keys = Object.keys(object);
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
if (enumerableOnly) {
|
|
symbols = symbols.filter(function(sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
});
|
|
}
|
|
keys.push.apply(keys, symbols);
|
|
}
|
|
|
|
return keys;
|
|
}
|
|
export function _object_spread_props(target, source) {
|
|
source = source != null ? source : {};
|
|
|
|
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
else {
|
|
ownKeys(Object(source)).forEach(function(key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
|
|
return target;
|
|
}
|
|
export { _object_spread_props as _ };
|