getOwnKeyDescriptor
Return a property descriptor for a named property on an object.
getOwnKeyDescriptor(obj, key)
Return the key descriptor for the property key key
on the Map-like object obj
. A key descriptor
is specified in ECMAScript 5 and contains keys for the property's configurable
and enumerable
states,
as well as either value
and writable
for value properties, or get
and set
for getter/setter properties.
The default behavior can be overridden by implementing @@can.getOwnKeyDescriptor
on obj
; otherwise the default is to call Object.getOwnKeyDescriptor()
.
var foo = new DefineMap({ bar: "baz" });
getOwnKeyDescriptor(foo, "bar"); // -> {configurable: true, writable: true, enumerable: true, value: "baz"}
Parameters
- obj
{Object}
:Any object with named properties
- key
{String}
:The property name to look up on
obj
Returns
{Object}
:
A key descriptor object