mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-24 01:43:18 +00:00
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
|
var $ = require('../internals/export');
|
||
|
var DESCRIPTORS = require('../internals/descriptors');
|
||
|
var ownKeys = require('../internals/own-keys');
|
||
|
var toIndexedObject = require('../internals/to-indexed-object');
|
||
|
var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
||
|
var createProperty = require('../internals/create-property');
|
||
|
|
||
|
// `Object.getOwnPropertyDescriptors` method
|
||
|
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
|
||
|
$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {
|
||
|
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
|
||
|
var O = toIndexedObject(object);
|
||
|
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
||
|
var keys = ownKeys(O);
|
||
|
var result = {};
|
||
|
var index = 0;
|
||
|
var key, descriptor;
|
||
|
while (keys.length > index) {
|
||
|
descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);
|
||
|
if (descriptor !== undefined) createProperty(result, key, descriptor);
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
});
|