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

comparator for custom equality checks #187

Closed
wants to merge 1 commit into from

Conversation

schornio
Copy link
Contributor

@schornio schornio commented Aug 3, 2017

Extended equal-function to support a custom comparator. Useful for diffArray.

Solves #183

if (this.options.comparator) {
if (Array.isArray(right)) {
right = right[0];
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this array lookup doing? Is there a case where arrays are passed in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is some edge case - maybe because of how this lib uses tokenize() and join()

arrayDiff.tokenize = arrayDiff.join = function(value) {
  return value.slice();
};

@schornio
Copy link
Contributor Author

schornio commented Oct 6, 2017

Any chance this gets merged?

@kpdecker
Copy link
Owner

kpdecker commented Oct 7, 2017

Merged, but rebased and fixed the handling of the array concern.

@kpdecker kpdecker closed this Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants