Skip to content

Adding option tomatch array elements when comparing #18

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

peizguo
Copy link

@peizguo peizguo commented Feb 22, 2016

When comparing the following two arrays:
array1 = [{id: 123, color: 'green'}, {id: 456, color: 'red'}]
array2 = [{id: 123, color: 'green'}, {id: 789, color: 'blue'}]
Instead of a result {:update => {1: {:update => {id: 789, color: 'blue'}}}}
What you get by passing the :id as the matching key
{:remove => {1: {id: 456, color: 'red'}}, :append => {1: {id: 789, color: 'blue'}}}

Peizong Guo added 4 commits February 22, 2016 11:24
When elements in two array match by the matching_key, it will be treated as update
Compatible with previous arguments
Add document for array comparison with matching key
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.

1 participant