mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 11:11:30 +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
25 lines
760 B
JavaScript
25 lines
760 B
JavaScript
export function _define_enumerable_properties(obj, descs) {
|
|
for (var key in descs) {
|
|
var desc = descs[key];
|
|
desc.configurable = desc.enumerable = true;
|
|
|
|
if ("value" in desc) desc.writable = true;
|
|
|
|
Object.defineProperty(obj, key, desc);
|
|
}
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
var objectSymbols = Object.getOwnPropertySymbols(descs);
|
|
for (var i = 0; i < objectSymbols.length; i++) {
|
|
var sym = objectSymbols[i];
|
|
var desc = descs[sym];
|
|
desc.configurable = desc.enumerable = true;
|
|
if ("value" in desc) desc.writable = true;
|
|
Object.defineProperty(obj, sym, desc);
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
export { _define_enumerable_properties as _ };
|