Closed adius closed 6 years ago
Are you hitting bugs in usage with the right hand binding being null
or undefined
?
All the x in y
checks in svg-term-cli
happen on shallow objects without protoype chain, so there should be no pressing reason to use hasOwnProperty
.
shallow objects without protoype chain
Even they have properties:
"toString" in ({foo:"bar"})
yields true
You need to make sure that you cli flags never match with one of the default properties. Also they could add new properties in future JavaScript version, and then your code would suddenly break. It's really dangerous and just not worth the little syntax sugar.
Understood. This could increase the sturdiness of the CLI. As of now this a "third line of defense" type of thing, the first two being:
In JavaScript you can't have enough lines of defense. It's such a broken language. 🙈 Even TypeScript can't really help. I switched to PureScript because of this. It's such a pleasure 😍.
Just wanted to make sure you're aware of the situation.
https://stackoverflow.com/questions/13632999/if-key-in-object-or-ifobject-hasownpropertykey