How to use the until function from ramda

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

9
10
11
12
13
14
15
16
17
18
19
const getMidElement = R.converge(R.nth, [getMidIndex, R.prop("list")]);
const getSearchValue = R.prop("searchValue");


var binarySearch = R.compose(
  R.prop("ans"),
  R.until(
    R.either(
      R.compose(R.not, R.compose(R.isNil, R.prop("ans"))),
      R.compose(R.apply(R.gt), R.props(["lower", "upper"]))
    ),
fork icon0
star icon0
watch icon0

4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
 * @param {Function} fn The iterator function
 * @param {*} init Initial value
 * @return {*} Final value that satisfies predicate
 * @example
 *
 *      R.until(R.gt(R.__, 100), R.multiply(2))(1) // => 128
 */
var until = _curry3(function until(pred, fn, init) {
    var val = init;
    while (!pred(val)) {
fork icon0
star icon0
watch icon0

+ 17 other calls in file

29
30
31
32
33
34
35
36
37
38
39
  return [R.length(flashPoints), newBoard];
};


const doStep = R.compose(
    ([count, board]) => [count, U.mapBoard(R.max(0), board)],
    R.until(R.compose(R.not, willFlash, R.nth(1)), ([total, board]) => {
      const [count, newBoard] = flash(board);
      return [total + count, newBoard];
    }),
    (board) => [0, board],
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)