UNPKG

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