Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
848 bytes
|
Line | |
---|
1 | var DESCRIPTORS = require('../internals/descriptors');
|
---|
2 | var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
---|
3 | var anObject = require('../internals/an-object');
|
---|
4 | var toPropertyKey = require('../internals/to-property-key');
|
---|
5 |
|
---|
6 | // eslint-disable-next-line es/no-object-defineproperty -- safe
|
---|
7 | var $defineProperty = Object.defineProperty;
|
---|
8 |
|
---|
9 | // `Object.defineProperty` method
|
---|
10 | // https://tc39.es/ecma262/#sec-object.defineproperty
|
---|
11 | exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {
|
---|
12 | anObject(O);
|
---|
13 | P = toPropertyKey(P);
|
---|
14 | anObject(Attributes);
|
---|
15 | if (IE8_DOM_DEFINE) try {
|
---|
16 | return $defineProperty(O, P, Attributes);
|
---|
17 | } catch (error) { /* empty */ }
|
---|
18 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
---|
19 | if ('value' in Attributes) O[P] = Attributes.value;
|
---|
20 | return O;
|
---|
21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.