How to use the mergeDeepWithKey function from ramda

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

205
206
207
208
209
210
211
212
213
214
215
216
}


const getCurrentPath = (path, key) =>  path ? `${path}.${key}` : key


const mergeNestedMappings = (map1, map2) => {
  return R.mergeDeepWithKey((key, item1, item2) => {
    if (key === '$references') return [...item1, ...item2]
    logger.warn(`had an unexpected key collision while merging nested translation mappings. key: ${key}`)
  }, map1, map2)
}
fork icon3
star icon6
watch icon0

34
35
36
37
38
39
40
41
42
43
44
  R.sum,
  R.drop(1)
))


// concat :: Link -> Link -> Link
const concat = R.mergeDeepWithKey(
  R.cond([
    [R.equals('tags'), mergeArray],
    [R.equals('attempts'), mergeInteger],
    [R.T, mergeString]
fork icon0
star icon4
watch icon0

9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
* @return {Object}
* @see R.mergeWithKey, R.mergeDeepWith
* @example
*
*      let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
*      R.mergeDeepWithKey(concatValues,
*                         { a: true, c: { thing: 'foo', values: [10, 20] }},
*                         { b: true, c: { thing: 'bar', values: [15, 35] }});
*      //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}
*/
fork icon0
star icon0
watch icon2

+ 3 other calls in file

64
65
66
67
68
69
70
71
72
73
  day = splitDate[2]
let structuredEvent = R.assocPath([year, month, day, "data"], [event], {
  a: 5,
})

EventsList = R.mergeDeepWithKey(
  concatValues,
  EventsList,
  structuredEvent
)
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)