How to use the groupWith function from ramda

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

2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
*        treated as a list of characters.
* @return {List} A list that contains sublists of equal elements,
*         whose concatenations are equal to the original list.
* @example
*
* R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
* //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]]
*
* R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
* //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
fork icon0
star icon0
watch icon0

+ 53 other calls in file

3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
* @example
*
* R.groupWith(R.equals, [0, 1, 1, 2, 3, 5, 8, 13, 21])
* //=> [[0], [1, 1], [2], [3], [5], [8], [13], [21]]
*
* R.groupWith((a, b) => a + 1 === b, [0, 1, 1, 2, 3, 5, 8, 13, 21])
* //=> [[0, 1], [1, 2, 3], [5], [8], [13], [21]]
*
* R.groupWith((a, b) => a % 2 === b % 2, [0, 1, 1, 2, 3, 5, 8, 13, 21])
* //=> [[0], [1, 1], [2], [3, 5], [8], [13, 21]]
fork icon0
star icon0
watch icon2

+ 15 other calls in file

12
13
14
15
16
17
18
19
20
21
22
23
    R.filter(R.compose(R.not, R.equals(''))),
    R.split(' ')));


const boards = R.compose(
    R.map(R.compose(parseBoard, R.dropLast(1))),
    R.groupWith(R.compose(R.not, R.equals(''))),
    R.drop(2))(input);


const markNumber = (n) => R.map(
    R.map(R.ifElse(R.equals(n), R.always(-1), R.identity)));
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)