-
Notifications
You must be signed in to change notification settings - Fork 34
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
fix(lib): Diff of array should consider both sides #46
Conversation
Current coverage is
|
LGTM |
I had considered the proposed implementation (absolute difference) but let me say why I have considered the current implementation (relative difference). Let's suppose, my current config is // diff(all-available, current) => [ only the rules present in all-available but no in current]
diff(['a', 'b', 'c', 'd', 'e'], ['a', 'b', 'x', 'y', 'z']) => [ 'c', 'd', 'e'] and not If we display [ 'x', 'y', 'z', 'c', 'd', 'e'] as the list of unused rules, user might get confused why ['x', 'y', 'z'] is being displayed as unused, when it is part of the current config. However, we might // diff(current, all-available) => [ only the rules present in current but no in all-available]
diff(['a', 'b', 'x', 'y', 'z'], ['a', 'b', 'c', 'd', 'e']) => ['x', 'y', 'z'] and display that
_.difference([3, 2, 1], [4, 2]);
// → [3, 1] Please correct me if I have misinterpreted. |
Hmm... I now got what you were doing and considering an invokation of What about this: |
Yes, something like
I doubt one concise list will be useful, we we cant label the difference with each file, similar to Why not call If your are still convinced with a concise list of
|
What about a totally different approach?
For the "non-verbose"/default output of
(The meaning of the output between |
Sorry I don't follow.
with respect to
What is Is it rule config?
Am I reading it correct? |
Sorry, it's sometimes hard for me to be presice due to a lack of vocabulary 😜
Exactly. |
No worries!! Awesome, it would be great. Is this PR still good or #47 should take take of it? |
I think this one's bonkers. I'd say, we extend #47 to include your proposal:
and eventually we'd have a consistent behavior accross the two output levels of |
Superceded by #50 ( |
At the moment,
lib/array-diff.js
in my opinion return an erroneous diff:It should also take those elements of array
b
not present in arraya
into account: