Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1x 1x | /* * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Copyright (c) 2018 Mobify Research & Development Inc. All rights reserved. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
import Immutable from 'immutable'
const isList = Immutable.List.isList
// Ensures the new list is always used when merging Maps that contain lists
// Otherwise we would end up with something like this:
// for a = {test: [1, 2, 3]}, b = {test: [1, 2]}
// a.mergeDeep(b) => {test: [1, 2, 3]}
// When we want it to return {test: [1, 2]} (ie. delete the third item)
// Based on: https://github.com/facebook/immutable-js/issues/762
export const skipListsMerger = (a, b) => {
if (a && a.mergeWith && !isList(a) && !isList(b)) {
return a.mergeWith(skipListsMerger, b)
}
return b
}
|