How to use the object-path-immutable.del function in object-path-immutable

To help you get started, we’ve selected a few object-path-immutable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elastic / kibana / x-pack / plugins / canvas / public / state / reducers / elements.js View on Github external
function assignElementProperties(workpadState, pageId, elementId, props) {
  const pageIndex = getPageIndexById(workpadState, pageId);
  const elementsPath = ['pages', pageIndex, 'elements'];
  const elementIndex = get(workpadState, elementsPath, []).findIndex(
    element => element.id === elementId
  );

  if (pageIndex === -1 || elementIndex === -1) {
    return workpadState;
  }

  // remove any AST value from the element caused by https://github.com/elastic/kibana-canvas/issues/260
  // TODO: remove this after a bit of time
  const cleanWorkpadState = del(workpadState, elementsPath.concat([elementIndex, 'ast']));

  return assign(cleanWorkpadState, elementsPath.concat(elementIndex), props);
}
github elastic / kibana / x-pack / plugins / canvas / public / state / reducers / elements.js View on Github external
        (state, nextElementIndex) => del(state, ['pages', pageIndex, 'elements', nextElementIndex]),
        workpadState
github htmlburger / carbon-fields / assets / js / containers / reducer.js View on Github external
	[removeContainer]: (state, { payload }) => immutable.del(state, payload),
	[setContainerUI]: (state, action) => setMetaOrUI(state, action, 'ui'),
github inmagik / react-rocketjump / src / mutations / standard / multi.js View on Github external
return (state = { pendings: {}, errors: {} }, action) => {
    switch (action.type) {
      case PENDING: {
        const key = makeKey(...action.meta.params)
        return {
          errors: immutable.del(state.errors, key),
          pendings: {
            ...state.pendings,
            [key]: true,
          },
        }
      }
      case FAILURE: {
        const key = makeKey(...action.meta.params)
        return {
          errors: {
            ...state.errors,
            [key]: action.payload,
          },
          pendings: immutable.del(state.pendings, key),
        }
      }
github gilmarsquinelato / i18n-manager / src / folder / functions.ts View on Github external
export const removeTreeItem = (tree: ITreeItem[], item: ITreeItem): ITreeItem[] => {
  let newTree = tree;

  const children = tree.filter(it => it.parent === item.id);
  for (const child of children) {
    newTree = removeTreeItem(newTree, child);
  }

  const treeItemIndex = newTree.findIndex(it => it.id === item.id);

  return immutable.del(newTree, treeItemIndex.toString());
};
github inmagik / react-rocketjump / src / mutations / standard / multi.js View on Github external
return {
          errors: immutable.del(state.errors, key),
          pendings: {
            ...state.pendings,
            [key]: true,
          },
        }
      }
      case FAILURE: {
        const key = makeKey(...action.meta.params)
        return {
          errors: {
            ...state.errors,
            [key]: action.payload,
          },
          pendings: immutable.del(state.pendings, key),
        }
      }
      case SUCCESS: {
        const key = makeKey(...action.meta.params)
        return {
          ...state,
          pendings: immutable.del(state.pendings, key),
        }
      }
      default:
        return state
    }
  }
}
github inmagik / react-rocketjump / src / helpers.js View on Github external
  return props.reduce((obj, prop) => immutable.del(obj, prop), object)
}
github elastic / kibana / x-pack / plugins / canvas / public / state / reducers / resolved_args.js View on Github external
[flushContext]: (transientState, { payload: elementId }) => {
      return del(transientState, getFullPath([elementId, 'expressionContext']));
    },
github coverhound / active-redux / src / api / utils / index.js View on Github external
export const clearResources = (state, data) => {
  switch (typeof data) {
    case 'object': {
      if (Array.isArray(data)) return data.reduce(clearResources, state);
      const { type, id } = data;
      return imm.del(state, ['resources', type, id]);
    }
    case 'string': return imm.set(state, ['resources', data], {});
    case 'undefined': return imm.set(state, 'resources', {});
    default: return state;
  }
};

object-path-immutable

Modify deep object properties without modifying the original object (immutability). Works great with React and Redux.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis