-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adds support for equality operator #36
base: master
Are you sure you want to change the base?
adds support for equality operator #36
Conversation
@@ -325,7 +326,7 @@ proto.__set = function (prop, value, current, success, error) { | |||
// If validate opts are set and initing, validate properties only if validateOnInit is true | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 .