main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
941 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _curry1 from "./internal/_curry1.js";
|
---|
| 2 | import _dispatchable from "./internal/_dispatchable.js";
|
---|
| 3 | import _xdropRepeatsWith from "./internal/_xdropRepeatsWith.js";
|
---|
| 4 | import dropRepeatsWith from "./dropRepeatsWith.js";
|
---|
| 5 | import equals from "./equals.js";
|
---|
| 6 | /**
|
---|
| 7 | * Returns a new list without any consecutively repeating elements.
|
---|
| 8 | * [`R.equals`](#equals) is used to determine equality.
|
---|
| 9 | *
|
---|
| 10 | * Acts as a transducer if a transformer is given in list position.
|
---|
| 11 | *
|
---|
| 12 | * @func
|
---|
| 13 | * @memberOf R
|
---|
| 14 | * @since v0.14.0
|
---|
| 15 | * @category List
|
---|
| 16 | * @sig [a] -> [a]
|
---|
| 17 | * @param {Array} list The array to consider.
|
---|
| 18 | * @return {Array} `list` without repeating elements.
|
---|
| 19 | * @see R.transduce
|
---|
| 20 | * @example
|
---|
| 21 | *
|
---|
| 22 | * R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); //=> [1, 2, 3, 4, 2]
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | var dropRepeats =
|
---|
| 26 | /*#__PURE__*/
|
---|
| 27 | _curry1(
|
---|
| 28 | /*#__PURE__*/
|
---|
| 29 | _dispatchable([], function () {
|
---|
| 30 | return _xdropRepeatsWith(equals);
|
---|
| 31 | },
|
---|
| 32 | /*#__PURE__*/
|
---|
| 33 | dropRepeatsWith(equals)));
|
---|
| 34 |
|
---|
| 35 | export default dropRepeats; |
---|
Note:
See
TracBrowser
for help on using the repository browser.