Add nonUnique
function
#316
aleclarson
started this conversation in
Ideas
Replies: 1 comment
-
We can think about more generic util for which I don't have a nice name (could be a sign that we don't need such util, just share my ideas). const uniqueItems = countAndSelect(array, 1);
const pairedItems = countAndSelect(array, 2);
const nonUniqueItems = countAndSelect(array, count => count > 1); But we already have counting, so const countedItems = _.counting(array, v => v);
const pairedItems = array.filter(item => countedItems[item] === 2); And the same for const countedItems = _.counting(array, v => v);
const nonUniqueItems = array.filter(item => countedItems[item] > 1); BTW, should the second argument in |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The opposite of
unique
Todo
Beta Was this translation helpful? Give feedback.
All reactions