uniq-with

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
3
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
887 B
Returns a new list containing only one copy of each element in the original
1 contributor
Install uniq-with as a package?
Copied
npm i @bit/justin-capalbo.ramda.uniq-with
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
uniqWith (
pred:Function,
list:Array
) : Array

Returns a new list containing only one copy of each element in the original list, based upon the value returned by applying the supplied predicate to two list elements. Prefers the first item if two items compare equal based on the predicate.

Example
const strEq = R.eqBy(String);
     R.uniqWith(strEq)([1, '1', 2, 1]); //=> [1, 2]
     R.uniqWith(strEq)([{}, {}]);       //=> [{}]
     R.uniqWith(strEq)([1, '1', 1]);    //=> [1]
     R.uniqWith(strEq)(['1', 1, 1]);    //=> ['1']
Arguments
pred: Function

A predicate used to test whether two items are equal.

list: Array

The array to consider.

Returns
Array

The list of unique items.

Help and resources