Closed eriktim closed 8 years ago
@jdanyow Where is this at exactly? Can we merge this? Or does it need further work?
I think we need to get rid of the check that disallows Reflect.defineProperty on a function.
Yes, if we can remove that, it's probably good to go.
maybe i missunderstand you, but it's not disallowing, it's allowing
Gotcha. I was looking at the snippet and didn't see what was going on. I think this is ok then. @jdanyow Confirm?
I'd say it should become something like this:
if (typeof Reflect.defineProperty !== 'function') {
function isObject(obj) {
return typeof obj === 'object' ? obj !== null : typeof obj === 'function';
};
Reflect.defineProperty = function(target, propertyKey, descriptor) {
if (!isObject(target) || !isObject(descriptor)) {
throw new TypeError();
}
try {
Object.defineProperty(target, propertyKey, descriptor);
return true;
} catch (e) {
return false;
}
};
}
(The error message is browser specific anyway.)
looks good
Fix checking for non-null objects as suggested by doktordirk.