How to use the map function from ramda

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

129
130
131
132
133
134
135
136
137
138
}

setupB18(bname, version);
let counts = R.compose(
  R.countBy(R.identity),
  R.map(R.prop("color")),
  sortTiles,
  R.uniq,
  R.map(getTile)
)(R.keys(game.tiles));
fork icon52
star icon51
watch icon0

+ 4 other calls in file

82
83
84
85
86
87
88
89
90
91
92


const buildAllHtml = () => {
  ensureEmptyDir(JSX_OUTPUT);
  buildOverviewPages();
  R.pipe(
    R.map((chapter) => execMarkdownToHtml(chapter)),
    (routesOrig) => {
      const routes = [];
      let currentChapterNumber = -1;

fork icon16
star icon19
watch icon4

+ 3 other calls in file

32
33
34
35
36
37
38
39
40
41
42
43
44
const runSingleValidation = R.curry((value, actualObject, [test, message]) => (test(value, actualObject) ? null : message));


const returnFirstOccurrenceOfError = (value, object, rules) => R.compose(R.find(notNil), R.map(runSingleValidation(value, object)))(rules);


const runValidations = R.curry(
	(actualObject, dataSet) => R.map((dataRule) => returnFirstOccurrenceOfError(dataRule.value, actualObject, dataRule.rules))(dataSet)
);


module.exports = (rules, data) => {
	const result = data || {};
fork icon4
star icon2
watch icon2

+ 275 other calls in file

149
150
151
152
153
154
155
156
157
158
// ${title}

${[
  ...new Set(
    R.concat(
      R.map((t) => (exists(R.path(['type', 'import'], t)) ? `import "${R.path(['type', 'import'], t)}";${EOL}` : ''), rootStruct),
      R.map((i) => (exists(i) ? `import "${i}";${EOL}` : ''), R.map(R.path(['import']), generatedScalars))
    )
  ),
].join('')}
fork icon3
star icon44
watch icon6

+ 13 other calls in file

670
671
672
673
674
675
676
677
678
679
  strictEqual(filesWithExtension('go', files).length, 2)
  strictEqual(filesWithExtension('rb', files).length, 1)
})

it('should use match as a generalize switch statement', () => {
  const output = R.map(
    (x) =>
      match(x)
        .on((x) => x === 1, R.identity)
        .on((x) => x === 3, R.identity)
fork icon3
star icon44
watch icon6

114
115
116
117
118
119
120
121
122
}

case REDIS_TYPES.SET: {
  const setMembers = await responseCache.smembers(`${instanceKey}:${key}`)
  if (['participants', 'participantList'].includes(key)) {
    data[key] = map(isUuidValid, setMembers)
  } else {
    data[key] = setMembers
  }
fork icon12
star icon32
watch icon5

332
333
334
335
336
337
338
339
340
341
	})
)

const data = await response.json()

const result = R.map(
	date =>
		date
			.filter(x =>
				['Sites web', 'Moteurs de recherche', 'Entrées directes'].includes(
fork icon4
star icon40
watch icon0

20
21
22
23
24
25
26
27
28
29
// Reduce token0 and token1
// If deposit
// Reduce LP tokens
// In both cases, amountBuy for each order will be reduced
const { orders } = validatedData
const ordersPostSlippage = R.map(
  R.over(
    R.lensPath(amountBuyPath),
    reduceBySlippage(slippage)
  )
fork icon21
star icon22
watch icon0

99
100
101
102
103
104
105
106
107
 * @type {Function}
 */
const createMultipleParamIdentifiers = (data) => data.map((d, idx) => R.compose(
  R.join(' , '),
  // @ts-ignore
  R.map(paramNameWithIdx(idx)),
  R.keys
// @ts-ignore
)(d))
fork icon14
star icon12
watch icon11

+ 11 other calls in file

10
11
12
13
14
15
16
17
18
19
20
21
  attempts: 0
}


const lens = R.compose(
  R.fromPairs,
  R.map(([k, _]) => [k, R.lensProp(k)]),
  R.toPairs
)(defaults)


const mergeString = R.unapply(R.compose(
fork icon0
star icon4
watch icon0

49
50
51
52
53
54
55
56
57
58
    remove$: forwardTo(actions$, R.always(Action.Remove(id))),
  }, model);
});

const view = R.curry((actions$, model) => {
  const counters = R.map(viewCounter(actions$), model.counters);
  return h('div',
    R.prepend(h('button.add', {on: {click: [actions$, Action.Insert()]}}, 'Add'),
              counters)
  );
fork icon91
star icon0
watch icon2

+ 9 other calls in file

43
44
45
46
47
48
49
50
51
  h('button.add', {
    on: {click: [actions, Action.Insert()]}
  }, 'Add counter')

const view = R.curry((actions, model) => {
  const counters = R.map(viewCounter(actions), model.counters)
  return h('div', R.prepend(addBtn(actions), counters))
})

fork icon91
star icon0
watch icon2

+ 9 other calls in file

93
94
95
96
97
98
99
100
101
102
    escaped = formatFn.literal(value);
  }
  return escaped;
};

const vals = R.map(
  R.pipe(
    R.props(keys),
    R.map(escapeValue),
    R.join(',')
fork icon1
star icon6
watch icon0

+ 15 other calls in file

24
25
26
27
28
29
30
31
32
33
34
35
};


const makeSliders = (src, dest) => {
    const mainSlider = createWriteStream(dest);
    const horizontalSliders = folders(src).map(concat(src));
    const verticalSliders = map(makeVerticalSliders, horizontalSliders);


    for (const content of verticalSliders) {
        mainSlider.write(content.join(''));
        mainSlider.write(SEPARATOR);
fork icon4
star icon5
watch icon0

68
69
70
71
72
73
74
75
76
77
78
79
};




const transformData = (aliasToMemberNameMap, annotation, data) => (data.map(r => R.pipe(
  R.toPairs,
  R.map(p => {
    const memberName = aliasToMemberNameMap[p[0]];
    const annotationForMember = annotation[memberName];
    if (!annotationForMember) {
      throw new UserError(`You requested hidden member: '${p[0]}'. Please make it visible using \`shown: true\``);
fork icon2
star icon5
watch icon0

+ 7 other calls in file

3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
dt: '[[[S+]F][F]]',
compose: function (s, pl) {
    var words = toPLOrNull(s === null || s === void 0 ? void 0 : s.pop());
    var argList = r.clone(toArrOfStrOrNull(s === null || s === void 0 ? void 0 : s.pop()));
    if (words !== null && argList) {
        var values = r.map(function () { return s === null || s === void 0 ? void 0 : s.pop(); }, argList);
        // const localWD: { [index: string]: Word } =
        //     r.zipObj(r.flatten(r.reverse(argList)), r.flatten(values));
        var localWD = deepZipObj(r.reverse(argList), values);
        var newWords = toPLOrNull(subInWD(localWD, words));
fork icon0
star icon5
watch icon2

+ 19 other calls in file

74
75
76
77
78
79
80
81
82
83
84
  })
}
mkQueue(queueSize).addAll(errors_.map((inputElement, inputElementIndex) => async jobIndex => { mapper(output, inputElement, inputElementIndex, doms[jobIndex]) }))


output_ = R.groupBy(R.prop('kanji'), output)
output_ = R.map(xs => R.uniq(xs.map(x => x.transl).flat().filter(x => x)), output_)
output_ = R.toPairs(output_)
output_ = output_.map(([kanji, transl]) => ({ kanji, transl }))
output_ = output_.filter(x => !R.isEmpty(x.transl))

fork icon0
star icon4
watch icon2

9
10
11
12
13
14
15
16
17
18
19
20
}


function prepare_controller({ logger, prefix, controller, error_handling_strategy }) {
    // for swagger router:
    // 'prefix_' * { 'a': b } => { 'prefix_a': b }
    const prefixed_action_names = map(action_name => prefix + action_name, Object.keys(controller))
    const add_error_handing = partialRight(error_handling_strategy, [logger])
    const wrapped_actions = map(add_error_handing, Object.values(controller))


    return zipObj(prefixed_action_names, wrapped_actions)
fork icon0
star icon3
watch icon0

275
276
277
278
279
280
281
282
283
284
var hotelID = _ref17.hotelID,
    ids = _ref17.offers;
return R.mergeAll([{
  hotel: hotels[hotelID]
}, {
  offers: R.map(function (id) {
    return R.mergeAll([offers[id], {
      hotelID: hotelID
    }]);
  }, ids)
fork icon0
star icon3
watch icon4

+ 209 other calls in file

66
67
68
69
70
71
72
73
74
return R.call(R.pipe(R.toPairs, R.filter(function (_ref6) {
  var _ref7 = _slicedToArray(_ref6, 2),
      value = _ref7[1];

  return value !== null && _typeof(value) === 'object';
}), R.map(function (_ref8) {
  var _ref9 = _slicedToArray(_ref8, 2),
      key = _ref9[0],
      value = _ref9[1];
fork icon0
star icon3
watch icon3

Other functions in ramda

Sorted by popularity

function icon

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