SHARE
TWEET

Untitled

Siri0n Jan 19th, 2017 (edited) 81 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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top