Advertisement
Siri0n

Untitled

Jan 19th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if(command.type == "REMOVE"){
  2.     state = state.deleteIn(["lists", command.nodeType, "nodes", command.id]);
  3.     state = state.updateIn(["lists", command.nodeType, "ids"], list => list.filter(id => id != command.id));
  4.     state = state.update("names", names => names.delete(command.id));
  5.     state.get("lists").forEach((list, type) => {
  6.         list.get("nodes").forEach((node, id) => {
  7.             state = state.updateIn(["lists", type, "nodes", id, "connections", "data"],
  8.                 data => data.filter(elem => elem.get("id") != command.id));
  9.             state = state.updateIn(["lists", type, "nodes", id, "connections", "order"],
  10.                 order => order.filter(elem => elem.split(".")[0] != command.id));
  11.             return true;
  12.         });
  13.         return true;
  14.     });
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement