source: node_modules/ramda/es/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.1 KB
Line 
1import _curry2 from "./internal/_curry2.js";
2import _dispatchable from "./internal/_dispatchable.js";
3import _xdropRepeatsWith from "./internal/_xdropRepeatsWith.js";
4import dropRepeatsWith from "./dropRepeatsWith.js";
5import eqBy from "./eqBy.js";
6/**
7 * Returns a new list without any consecutively repeating elements,
8 * based upon the value returned by applying the supplied function to
9 * each list element. [`R.equals`](#equals) is used to determine equality.
10 *
11 * Acts as a transducer if a transformer is given in list position.
12 *
13 * @func
14 * @memberOf R
15 * @since v0.29.0
16 * @category List
17 * @sig (a -> b) -> [a] -> [a]
18 * @param {Function} fn A function used to produce a value to use during comparisons.
19 * @param {Array} list The array to consider.
20 * @return {Array} `list` without repeating elements.
21 * @see R.transduce
22 * @example
23 *
24 * R.dropRepeatsBy(Math.abs, [1, -1, -1, 2, 3, -4, 4, 2, 2]); //=> [1, 2, 3, -4, 2]
25 */
26
27var dropRepeatsBy =
28/*#__PURE__*/
29_curry2(function (fn, list) {
30 return _dispatchable([], function () {
31 return _xdropRepeatsWith(eqBy(fn));
32 }, dropRepeatsWith(eqBy(fn)))(list);
33});
34
35export default dropRepeatsBy;
Note: See TracBrowser for help on using the repository browser.