Closed andreidmt closed 3 years ago
Hey @dgilperez, added this PR based on your #7 proposal.
Waiting for your thought and can continue with difference
after we finish with these.
Hey, sorry for the delay @andreidmt
The changes on intersect
and distinct
make a lot of sense in my opinion.
Otoh, I think overlap
is a confusing term - for me, overlap is almost a synonym for intersection. I'd argue the proposed implementation for overlap is actually a join
. If we go to SQL joins, there are a number of different joins of course (left, right, inner, outer ...), adding to the confusion, but in general terms I think is a better term for this operation.
I like the idea of syncing the naming with SQL operations (where applicable). Renamed "overlap" -> "join" and the old join to "unite".
:tada: This PR is included in version 6.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thoughts and proposals on #7 by @dgilperez:
intersect
is misleading. Implemented it as you proposed and as any sane person would expectintersect
to behave, return common items.deepEquals
so I've createdintersectBy
to be geared towards object arrays and leftintersect
with a shallow equals.intersect
asoverlap
/overlapBy
. As I'm writing,union
seems a better name for it.intersect
andoverlap
is the return of distinct items.Primary
intersect
to return common and distinct items from two arrays.intersectBy
. Allow custompredicate
andmerge
functions, geared towards object arrays.overlap
andoverlapBy
functions to combine two arrays into one with distinct items.Secondary
distinct
to use shallow compare.distinctBy
. Allow custom compare function, geared towards object arrays.Checklist
src/index.js