Erik Arvidsson erik.arvidsson at
Tue Mar 12 11:07:23 PDT 2013

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);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list