Understand the uniqBy implementation #3342
Unanswered
mantey-github
asked this question in
Q&A
Replies: 1 comment
-
Hi @mantey-github! I'm not on the ramda team but got intrigued by your question :) At a glance one could think it is a standard javascript Set but it is an internal ramda _Set where the add function returns true/false depending on if the item was added. Look into _Set.prototype.add and hasOrAdd |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Ramda team,
From the uniqBy implementation
new Set() was used in order to check the uniqueness of the elements in the list.
I would like to know why the
add()
method was used and not thehas()
? The conditionif (set.add(appliedItem))
will always return true or?Beta Was this translation helpful? Give feedback.
All reactions