I thought we talked about adding a function like getOwnPropertyDescriptor
that walks the prototype chain. This is a common function and I have seen a
lot of people polyfill this as Object.getPropertyDescriptor.
Can we add @reflect getPropertyDescriptor that would work something like?
export function getPropertyDescriptor(object, name) {
if (Object(object) !== object)
throw new TypeError();
return getPropertyDescriptorInternal(object, name);
}
function getPropertyDescriptorInternal(object, name) {
if (object === null)
return undefined;
var descr = Object.getOwnPropertyDescriptor(object, name);
if (descr)
return descr;
return getPropertyDescriptorInternal(Object.getPrototypeOf(object), name);
}
--
erik
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss