How to use the reduced function from ramda

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

12243
12244
12245
12246
12247
12248
12249
12250
12251
* @return {*} The wrapped value.
* @see R.reduce, R.reduceWhile, R.transduce
* @example
*
*     R.reduce(
*       (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item),
*       [],
*       [1, 2, 3, 4, 5]) // [1, 2, 3]
*/
fork icon0
star icon0
watch icon2

+ 3 other calls in file

87
88
89
90
91
92
93
94
95
96
  
  const distance = delta.x + delta.y
  const isCovered = (distance - 1) <= data.distance

  if (isCovered) {
    return R.reduced(true)
  }

  return false
},
fork icon0
star icon0
watch icon0

42
43
44
45
46
47
48
49
50
51
52
53
54


console.log(winningScore);


const lastWinningScore = R.reduce((boards, n) => {
  if (R.length(boards) === 1) {
    return R.reduced(n * (score(R.head(boards)) - n));
  }


  return R.compose(
      R.filter(R.compose(R.not, isWinner)),
fork icon0
star icon0
watch icon0

11
12
13
14
15
16
17
18
19
20
21
22
23


const findLineMismatch = R.reduce((stack, p) => {
  if (isOpen(p)) return R.prepend(p, stack);


  [top, ...stack] = stack;
  if (!isMatchingClose(top, p)) return R.reduced(p);


  return stack;
}, []);

fork icon0
star icon0
watch icon0

69
70
71
72
73
74
75
76
77
78
  const newProgram = flipOperation(instructions, positionToTry)
  if (newProgram) {
    const newRunState = runProgram(newProgram)
    if (newRunState.exit === "SUCCESS") {
      console.log(`Fix found by flipping line ${positionToTry + 1}`)
      return R.reduced(newRunState)
    }
  }
  return false
}
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)