drop-repeats-with

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
3
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
1 KB
Returns a new list without any consecutively repeating elements.
1 contributor
Install drop-repeats-with as a package?
Copied
npm i @bit/justin-capalbo.ramda.drop-repeats-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
dropRepeatsWith (
pred:Function,
list:Array
) : Array

Returns a new list without any consecutively repeating elements. Equality is determined by applying the supplied predicate to each pair of consecutive elements. The first element in a series of equal elements will be preserved.

Acts as a transducer if a transformer is given in list position.

Example
const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3];
     R.dropRepeatsWith(R.eqBy(Math.abs), l); //=> [1, 3, 4, -5, 3]
Arguments
pred: Function

A predicate used to test whether two items are equal.

list: Array

The array to consider.

Returns
Array

`list` without repeating elements.

Help and resources