defineEnumerableProperties.js 855 B

123456789101112131415161718192021222324252627282930
  1. var _Object$getOwnPropertySymbols = require("../core-js/object/get-own-property-symbols");
  2. var _Object$defineProperty = require("../core-js/object/define-property");
  3. function _defineEnumerableProperties(obj, descs) {
  4. for (var key in descs) {
  5. var desc = descs[key];
  6. desc.configurable = desc.enumerable = true;
  7. if ("value" in desc) desc.writable = true;
  8. _Object$defineProperty(obj, key, desc);
  9. }
  10. if (_Object$getOwnPropertySymbols) {
  11. var objectSymbols = _Object$getOwnPropertySymbols(descs);
  12. for (var i = 0; i < objectSymbols.length; i++) {
  13. var sym = objectSymbols[i];
  14. var desc = descs[sym];
  15. desc.configurable = desc.enumerable = true;
  16. if ("value" in desc) desc.writable = true;
  17. _Object$defineProperty(obj, sym, desc);
  18. }
  19. }
  20. return obj;
  21. }
  22. module.exports = _defineEnumerableProperties;