You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
649 B

4 years ago
  1. export default 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. }