Open ghostsquad opened 2 years ago
So you are suggesting renaming Intersect
into IntersectAll
then adding Intersect
that returns unique values?
Looks good.
Those intersection helpers are getting a little bit complicated. I think we should use the same naming as SQL. What about coding some LeftJoin, InnerJoin, FullOuterJoin...
I am also wondering if we should accept variadic arguments? Such as Intersect(collection1, collection2, collection3, collection4)
Ya, I like intersect, and intersectAll.
Variadic args seems useful. I'll update/create some more PRs
This bug should be fixed.
Changing what the function fundamentally does, without changing the signature, is going to cause grievances that will not be caught by the compiler, for the current consumers.
Changing what the function fundamentally does, without changing the signature, is going to cause grievances that will not be caught by the compiler, for the current consumers.
Bugfixes change behavior. That's by design.
The expectation of this function, as mentioned in the description/commit message is that lodash intersect returns unique results. intersect
in SQL also returns unique results. This should not differ from the current established expectations.
Lodash describes this operation as returning unique entries https://lodash.com/docs/#intersection
Also described in SQL: https://www.postgresql.org/docs/9.4/queries-union.html
https://docs.microsoft.com/en-us/sql/t-sql/language-elements/set-operators-except-and-intersect-transact-sql?view=sql-server-ver15