Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

adds support for equality operator #36

wants to merge 1 commit into from

Conversation

kylegifford
Copy link

Fixes #35 .

@@ -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());
Copy link
Contributor

@Macrofig Macrofig Jul 21, 2016

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?

Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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.

ccummings added a commit that referenced this pull request Sep 22, 2016
ccummings added a commit that referenced this pull request Oct 11, 2016
Adding equality operator fix from #36.
ccummings added a commit that referenced this pull request Oct 22, 2016
Adding equality operator fix from #36.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants