How to use the dropLastWhile function from ramda

Find comprehensive JavaScript ramda.dropLastWhile code examples handpicked from public code repositorys.

5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
 * @see R.takeLastWhile, R.addIndex
 * @example
 *
 *      var lteThree = x => x <= 3;
 *
 *      R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
 */
var dropLastWhile = _curry2(_dispatchable('dropLastWhile', _xdropLastWhile, _dropLastWhile));

/**
fork icon0
star icon0
watch icon0

+ 17 other calls in file

2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
 *
 *      const lteThree = x => x <= 3;
 *
 *      R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); //=> [1, 2, 3, 4]
 *
 *      R.dropLastWhile(x => x !== 'd' , 'Ramda'); //=> 'Ramd'
 */




var dropLastWhile =
fork icon0
star icon0
watch icon2

+ 7 other calls in file

52
53
54
55
56
57
58
59
60
61
62
63
const getNeighbour = (n, path, dir) => {
  if (R.nth(-1, path) === 1 - dir) {
    return decend(n, 1 - dir, [...R.dropLast(1, path), dir]);
  }


  path = R.dropLastWhile(R.equals(dir), path);
  if (R.equals(path, [])) return [];


  return decend(n, 1 - dir, [...R.dropLast(1, path), dir]);
};
fork icon0
star icon0
watch icon0

+ 3 other calls in file

30
31
32
33
34
35
36
37
38
39
40
41
42
43


  if (needsSlash) return ra.concatRight("/", pathWithoutLastSlash)
  return pathWithoutLastSlash
}


const removeLastSlash = r.dropLastWhile(r.equals("/"))


const moduleFileExtensions = [".js", ".ts", ".tsx", ".mjs", ".json"]


const readConfigFile = function (file) {
fork icon0
star icon0
watch icon0

25
26
27
28
29
30
31
32
33
34
  concat('/'),
  // Remove any leading slashes
  // @ts-ignore
  dropWhile(equalsSlash),
  // Remove trailing slashes
  dropLastWhile(equalsSlash),
  trim,
  String
);

fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)