[BUGFIX] checking whether value key is in descriptor instead of checking if value is truthy since !!0 === false

class Foo {
  static bar = 0;
}

Foo.bar++;
// Cannot assign to read only property 'bar' of function
This commit is contained in:
Jay Phelps 2015-04-03 22:42:53 -07:00
parent 4bd19da3c2
commit d9cbce1862

View File

@ -4,7 +4,7 @@
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if (descriptor.value) descriptor.writable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}