You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
608 B
JavaScript
16 lines
608 B
JavaScript
7 years ago
|
var anObject = require('./_an-object')
|
||
|
, IE8_DOM_DEFINE = require('./_ie8-dom-define')
|
||
|
, toPrimitive = require('./_to-primitive')
|
||
|
, dP = Object.defineProperty;
|
||
|
|
||
|
exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){
|
||
|
anObject(O);
|
||
|
P = toPrimitive(P, true);
|
||
|
anObject(Attributes);
|
||
|
if(IE8_DOM_DEFINE)try {
|
||
|
return dP(O, P, Attributes);
|
||
|
} catch(e){ /* empty */ }
|
||
|
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
|
||
|
if('value' in Attributes)O[P] = Attributes.value;
|
||
|
return O;
|
||
|
};
|