defineEnumerableProperties.js 755 B

1234567891011121314151617181920
  1. function _defineEnumerableProperties(obj, descs) {
  2. for (var key in descs) {
  3. var desc = descs[key];
  4. desc.configurable = desc.enumerable = true;
  5. if ("value" in desc) desc.writable = true;
  6. Object.defineProperty(obj, key, desc);
  7. }
  8. if (Object.getOwnPropertySymbols) {
  9. var objectSymbols = Object.getOwnPropertySymbols(descs);
  10. for (var i = 0; i < objectSymbols.length; i++) {
  11. var sym = objectSymbols[i];
  12. var desc = descs[sym];
  13. desc.configurable = desc.enumerable = true;
  14. if ("value" in desc) desc.writable = true;
  15. Object.defineProperty(obj, sym, desc);
  16. }
  17. }
  18. return obj;
  19. }
  20. module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports;