lib/utilities.js
function setDeep(map, listKey, keyPath, value) {
  if (!Array.isArray(listKey)) {
    listKey = [listKey];
  }
  var change = typeof value === 'function' ? 'updateIn' : 'setIn';
  var subPaths = getPaths(map, listKey, keyPath);
  return map.withMutations(function (map) {
    subPaths.forEach(function (keyPath) {
      return map[change](keyPath, value);
    });
  });

  function getPaths(map, listKeys, keyPath) {
    var overview = arguments.length <= 3 || arguments[3] === undefined ? [keyPath] : arguments[3];

    var list = map.getIn(listKeys);
    if (list) {
      var size = list.size;
      for (var i = 0; i < size; i++) {
        overview.push([].concat(_toConsumableArray(listKeys), [i], _toConsumableArray(keyPath)));
        getPaths(map, [].concat(_toConsumableArray(listKeys), [i, listKeys[0]]), keyPath, overview);
      }
    }
    return overview;
  }
}
function setDeep(map, listKey, keyPath, value) {
  if (!Array.isArray(listKey)) {
    listKey = [listKey];
  }
  var change = typeof value === 'function' ? 'updateIn' : 'setIn';
  var subPaths = getPaths(map, listKey, keyPath);
  return map.withMutations(function (map) {
    subPaths.forEach(function (keyPath) {
      return map[change](keyPath, value);
    });
  });

  function getPaths(map, listKeys, keyPath) {
    var overview = arguments.length <= 3 || arguments[3] === undefined ? [keyPath] : arguments[3];

    var list = map.getIn(listKeys);
    if (list) {
      var size = list.size;
      for (var i = 0; i < size; i++) {
        overview.push([].concat(_toConsumableArray(listKeys), [i], _toConsumableArray(keyPath)));
        getPaths(map, [].concat(_toConsumableArray(listKeys), [i, listKeys[0]]), keyPath, overview);
      }
    }
    return overview;
  }
}
function setDeep ( map , listKey , keyPath , value ) { if ( ! Array . isArray ( listKey ) ) { listKey = [ listKey ] ; } var change = typeof value === 'function' ? 'updateIn' : 'setIn' ; var subPaths = getPaths ( map , listKey , keyPath ) ; return map . withMutations ( function ( map ) { subPaths . forEach ( function ( keyPath ) { return map [ change ] ( keyPath , value ) ; } ) ; } ) ; function getPaths ( map , listKeys , keyPath ) { var overview = arguments . length <= 3 || arguments [ 3 ] === undefined ? [ keyPath ] : arguments [ 3 ] ; var list = map . getIn ( listKeys ) ; if ( list ) { var size = list . size ; for ( var i = 0 ; i < size ; i ++ ) { overview . push ( [ ] . concat ( _toConsumableArray ( listKeys ) , [ i ] , _toConsumableArray ( keyPath ) ) ) ; getPaths ( map , [ ] . concat ( _toConsumableArray ( listKeys ) , [ i , listKeys [ 0 ] ] ) , keyPath , overview ) ; } } return overview ; } }
Changes the the values in the nested collection
@param {Immutable.Map} map     - [description]
@param {Array}         listKey - [description]
@param {Array}         keyPath - [description]
@param {*|Function}    value   - [description]
Changes the the values in the nested collection