UNPKG

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