Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8322789
object-define-property.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
object-define-property.js
View Options
var
DESCRIPTORS
=
require
(
'../internals/descriptors'
);
var
IE8_DOM_DEFINE
=
require
(
'../internals/ie8-dom-define'
);
var
V8_PROTOTYPE_DEFINE_BUG
=
require
(
'../internals/v8-prototype-define-bug'
);
var
anObject
=
require
(
'../internals/an-object'
);
var
toPropertyKey
=
require
(
'../internals/to-property-key'
);
var
$TypeError
=
TypeError
;
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
var
$defineProperty
=
Object
.
defineProperty
;
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
var
$getOwnPropertyDescriptor
=
Object
.
getOwnPropertyDescriptor
;
var
ENUMERABLE
=
'enumerable'
;
var
CONFIGURABLE
=
'configurable'
;
var
WRITABLE
=
'writable'
;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
exports
.
f
=
DESCRIPTORS
?
V8_PROTOTYPE_DEFINE_BUG
?
function
defineProperty
(
O
,
P
,
Attributes
)
{
anObject
(
O
);
P
=
toPropertyKey
(
P
);
anObject
(
Attributes
);
if
(
typeof
O
===
'function'
&&
P
===
'prototype'
&&
'value'
in
Attributes
&&
WRITABLE
in
Attributes
&&
!
Attributes
[
WRITABLE
])
{
var
current
=
$getOwnPropertyDescriptor
(
O
,
P
);
if
(
current
&&
current
[
WRITABLE
])
{
O
[
P
]
=
Attributes
.
value
;
Attributes
=
{
configurable
:
CONFIGURABLE
in
Attributes
?
Attributes
[
CONFIGURABLE
]
:
current
[
CONFIGURABLE
],
enumerable
:
ENUMERABLE
in
Attributes
?
Attributes
[
ENUMERABLE
]
:
current
[
ENUMERABLE
],
writable
:
false
};
}
}
return
$defineProperty
(
O
,
P
,
Attributes
);
}
:
$defineProperty
:
function
defineProperty
(
O
,
P
,
Attributes
)
{
anObject
(
O
);
P
=
toPropertyKey
(
P
);
anObject
(
Attributes
);
if
(
IE8_DOM_DEFINE
)
try
{
return
$defineProperty
(
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
;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 3, 7:47 AM (12 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3339059
Attached To
rDWAPPS Web applications
Event Timeline
Log In to Comment