source: node_modules/ramda/src/dropRepeatsBy.js

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: 1.2 KB
RevLine 
[d24f17c]1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2.js");
4
5var _dispatchable =
6/*#__PURE__*/
7require("./internal/_dispatchable.js");
8
9var _xdropRepeatsWith =
10/*#__PURE__*/
11require("./internal/_xdropRepeatsWith.js");
12
13var dropRepeatsWith =
14/*#__PURE__*/
15require("./dropRepeatsWith.js");
16
17var eqBy =
18/*#__PURE__*/
19require("./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
42var dropRepeatsBy =
43/*#__PURE__*/
44_curry2(function (fn, list) {
45 return _dispatchable([], function () {
46 return _xdropRepeatsWith(eqBy(fn));
47 }, dropRepeatsWith(eqBy(fn)))(list);
48});
49
50module.exports = dropRepeatsBy;
Note: See TracBrowser for help on using the repository browser.