How to use the repeat function from ramda

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

44
45
46
47
48
49
50
51
52
paneCommands = R.intersperse(`select-pane ${nextPaneFlag}`, paneCommands)
windowCommands.push(paneCommands)

// Wrap around to the first pane
windowCommands.push(
  R.repeat(`select-pane ${nextPaneFlag}`, 2));

// Choose layout
windowCommands.push(`select-layout ${window.layout}`)
fork icon1
star icon3
watch icon0

6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
* @param {*} value The value to repeat.
* @param {Number} n The desired size of the output list.
* @return {Array} A new array containing `n` `value`s.
* @example
*
*      R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']
*
*      var obj = {};
*      var repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]
*      repeatedObjs[0] === repeatedObjs[1]; //=> true
fork icon0
star icon0
watch icon0

+ 35 other calls in file

58
59
60
61
62
63
64
65
66
67
);
// console.log(
//   R.ap(
//     R.pipe(
//       R.prop("name"),
//       R.repeat
//     ),
//     R.prop("howManyCats")
//   )(cats)
// );
fork icon0
star icon0
watch icon0

+ 2 other calls in file

22
23
24
25
26
27
28
29
30
31
32
33
34


  return array;
};


const shuffleCards = () => {
  const cards = flatten(HORSES.map((horse) => repeat(horse, COUNT)));


  return shuffle(cards);
};

fork icon0
star icon0
watch icon0

12365
12366
12367
12368
12369
12370
12371
12372
12373
*      R.repeat('hi', 5); //=> ['hi', 'hi', 'hi', 'hi', 'hi']
*
*      const obj = {};
*      const repeatedObjs = R.repeat(obj, 5); //=> [{}, {}, {}, {}, {}]
*      repeatedObjs[0] === repeatedObjs[1]; //=> true
* @symb R.repeat(a, 0) = []
* @symb R.repeat(a, 1) = [a]
* @symb R.repeat(a, 2) = [a, a]
*/
fork icon0
star icon0
watch icon2

+ 23 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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