2016-10-10 03:43:44 +02:00
|
|
|
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
|
2017-08-14 05:01:11 +02:00
|
|
|
var dP = require('./_object-dp');
|
|
|
|
var $export = require('./_export');
|
|
|
|
var anObject = require('./_an-object');
|
|
|
|
var toPrimitive = require('./_to-primitive');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
// MS Edge has broken Reflect.defineProperty - throwing instead of returning false
|
2017-08-14 05:01:11 +02:00
|
|
|
$export($export.S + $export.F * require('./_fails')(function () {
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 });
|
2016-10-10 03:43:44 +02:00
|
|
|
}), 'Reflect', {
|
2017-08-14 05:01:11 +02:00
|
|
|
defineProperty: function defineProperty(target, propertyKey, attributes) {
|
2016-10-10 03:43:44 +02:00
|
|
|
anObject(target);
|
2017-05-27 17:36:13 +02:00
|
|
|
propertyKey = toPrimitive(propertyKey, true);
|
|
|
|
anObject(attributes);
|
2016-10-10 03:43:44 +02:00
|
|
|
try {
|
2017-05-27 17:36:13 +02:00
|
|
|
dP.f(target, propertyKey, attributes);
|
2016-10-10 03:43:44 +02:00
|
|
|
return true;
|
2017-08-14 05:01:11 +02:00
|
|
|
} catch (e) {
|
2016-10-10 03:43:44 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
});
|