mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 16:13:18 +00:00
21 lines
805 B
JavaScript
21 lines
805 B
JavaScript
var DESCRIPTORS = require('../internals/descriptors');
|
|
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
|
var anObject = require('../internals/an-object');
|
|
var toPrimitive = require('../internals/to-primitive');
|
|
|
|
var nativeDefineProperty = Object.defineProperty;
|
|
|
|
// `Object.defineProperty` method
|
|
// https://tc39.github.io/ecma262/#sec-object.defineproperty
|
|
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
|
anObject(O);
|
|
P = toPrimitive(P, true);
|
|
anObject(Attributes);
|
|
if (IE8_DOM_DEFINE) try {
|
|
return nativeDefineProperty(O, P, Attributes);
|
|
} catch (error) { /* empty */ }
|
|
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
return O;
|
|
};
|