How to use the reduceBy function from ramda

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

176
177
178
179
180
181
182
183
184
185
		: label.startsWith('/demande-mobilite')
		? '/demande-mobilité'
		: label

const sumVisits = (acc, { nb_visits }) => acc + nb_visits
const results = R.reduceBy(
	sumVisits,
	0,
	groupSimulateursIframesVisits,
	[...resultSimulateurs, ...resultIframes, coronavirusPage].filter(Boolean)
fork icon4
star icon40
watch icon0

6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
* @return {Object} An object with the output of `keyFn` for keys, mapped to the output of
*         `valueFn` for elements which produced that key when passed to `keyFn`.
* @see R.groupBy, R.reduce
* @example
*
*      var reduceToNamesBy = R.reduceBy((acc, student) => acc.concat(student.name), []);
*      var namesByGrade = reduceToNamesBy(function(student) {
*        var score = student.score;
*        return score < 65 ? 'F' :
*               score < 70 ? 'D' :
fork icon0
star icon0
watch icon0

+ 17 other calls in file

10
11
12
13
14
15
16
17
18
19
20
  );
  return generateDoc(await readTemplate(config.templatesPath, templateName));
});


const generateFromRequest = curry(async (config, req) => {
  const formDataByName = reduceBy(
    (acc, element) => element,
    {},
    prop("name"),
    req.formData
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)