UNPKG

1.41 kBJavaScriptView Raw
1import _curry2 from "./internal/_curry2.js";
2import _dispatchable from "./internal/_dispatchable.js";
3import _dropLastWhile from "./internal/_dropLastWhile.js";
4import _xdropLastWhile from "./internal/_xdropLastWhile.js";
5/**
6 * Returns a new list excluding all the tailing elements of a given list which
7 * satisfy the supplied predicate function. It passes each value from the right
8 * to the supplied predicate function, skipping elements until the predicate
9 * function returns a `falsy` value. The predicate function is applied to one argument:
10 * *(value)*.
11 *
12 * Acts as a transducer if a transformer is given in list position.
13 *
14 * @func
15 * @memberOf R
16 * @since v0.16.0
17 * @category List
18 * @sig (a -> Boolean) -> [a] -> [a]
19 * @sig (a -> Boolean) -> String -> String
20 * @param {Function} predicate The function to be called on each element
21 * @param {Array} xs The collection to iterate over.
22 * @return {Array} A new array without any trailing elements that return `falsy` values from the `predicate`.
23 * @see R.takeLastWhile, R.addIndex, R.drop, R.dropWhile
24 * @example
25 *
26 * const lteThree = x => x <= 3;
27 *
28 * R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
29 *
30 * R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd'
31 */
32
33var dropLastWhile =
34/*#__PURE__*/
35_curry2(
36/*#__PURE__*/
37_dispatchable([], _xdropLastWhile, _dropLastWhile));
38
39export default dropLastWhile;
\No newline at end of file