1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 |
|
---|
5 | var _dispatchable =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./internal/_dispatchable.js");
|
---|
8 |
|
---|
9 | var _xdropRepeatsWith =
|
---|
10 | /*#__PURE__*/
|
---|
11 | require("./internal/_xdropRepeatsWith.js");
|
---|
12 |
|
---|
13 | var dropRepeatsWith =
|
---|
14 | /*#__PURE__*/
|
---|
15 | require("./dropRepeatsWith.js");
|
---|
16 |
|
---|
17 | var eqBy =
|
---|
18 | /*#__PURE__*/
|
---|
19 | require("./eqBy.js");
|
---|
20 | /**
|
---|
21 | * Returns a new list without any consecutively repeating elements,
|
---|
22 | * based upon the value returned by applying the supplied function to
|
---|
23 | * each list element. [`R.equals`](#equals) is used to determine equality.
|
---|
24 | *
|
---|
25 | * Acts as a transducer if a transformer is given in list position.
|
---|
26 | *
|
---|
27 | * @func
|
---|
28 | * @memberOf R
|
---|
29 | * @since v0.29.0
|
---|
30 | * @category List
|
---|
31 | * @sig (a -> b) -> [a] -> [a]
|
---|
32 | * @param {Function} fn A function used to produce a value to use during comparisons.
|
---|
33 | * @param {Array} list The array to consider.
|
---|
34 | * @return {Array} `list` without repeating elements.
|
---|
35 | * @see R.transduce
|
---|
36 | * @example
|
---|
37 | *
|
---|
38 | * R.dropRepeatsBy(Math.abs, [1, -1, -1, 2, 3, -4, 4, 2, 2]); //=> [1, 2, 3, -4, 2]
|
---|
39 | */
|
---|
40 |
|
---|
41 |
|
---|
42 | var dropRepeatsBy =
|
---|
43 | /*#__PURE__*/
|
---|
44 | _curry2(function (fn, list) {
|
---|
45 | return _dispatchable([], function () {
|
---|
46 | return _xdropRepeatsWith(eqBy(fn));
|
---|
47 | }, dropRepeatsWith(eqBy(fn)))(list);
|
---|
48 | });
|
---|
49 |
|
---|
50 | module.exports = dropRepeatsBy; |
---|