check-more-types
check-more-types copied to clipboard
defend() blasts context
trafficstars
I think defend() should run the function in its context.
Trivial failing example:
const foo = {
bar: 'baz',
quux: check.defend(function quux(val) {
// TypeError; `this.bar` is undefined
return val.length > this.bar.length;
}, 'string')
};
hmm, I never used checks with OO examples, need to stop blasting the context
'string' should be something else I think but the issue is still valid