object-define-properties.js 911 B

1234567891011121314151617181920
  1. var DESCRIPTORS = require('../internals/descriptors');
  2. var V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');
  3. var definePropertyModule = require('../internals/object-define-property');
  4. var anObject = require('../internals/an-object');
  5. var toIndexedObject = require('../internals/to-indexed-object');
  6. var objectKeys = require('../internals/object-keys');
  7. // `Object.defineProperties` method
  8. // https://tc39.es/ecma262/#sec-object.defineproperties
  9. // eslint-disable-next-line es/no-object-defineproperties -- safe
  10. exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
  11. anObject(O);
  12. var props = toIndexedObject(Properties);
  13. var keys = objectKeys(Properties);
  14. var length = keys.length;
  15. var index = 0;
  16. var key;
  17. while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
  18. return O;
  19. };