adds support for equality operator#36
adds support for equality operator#36kylegifford wants to merge 1 commit intocanjs:masterfrom kylegifford:issue-35/equality-validator-support
Conversation
| if ((validateOpts && !mapIniting) || (validateOpts && mapIniting && validateOpts.validateOnInit)) { | ||
| // Validate item | ||
| allowSet = this._validateOne({key: prop, value: value}, validateOpts); | ||
| allowSet = this._validateOne({key: prop, value: value}, validateOpts, this.attr()); |
There was a problem hiding this comment.
It's probably a better idea to serialize the map instead of using attr, what do you think?
There was a problem hiding this comment.
Hrm... on second thought, maybe attr is better. What would happen if you wanted to check equality against a property with a getter?
There was a problem hiding this comment.
Just tested and it looks like .attr() doesn't retrieve the computed value from the getter (although it maybe should). For this to work, we'd need to look inside validateOpts, extract the property we need and .attr(prop) at this point. Not sure that's a great solution, though.
There was a problem hiding this comment.
Hrm. Bummer. I haven't pulled this down to try it out yet. I'll try it out tomorrow if that's ok.
Adding equality operator fix from #36.
Adding equality operator fix from #36.
Fixes #35 .