goodwin64

HWM - show diff between stacks

Jul 16th, 2023 (edited)
1,697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const indexMe = 1; // me
  2. const indexSimilar = 2; // similar
  3. const indexDifferent = 3; // different
  4. const allStacksObj = Object.values(window?.stage?.pole?.obj || {});
  5.  
  6. const stackMe = allStacksObj[indexMe];
  7. const stackSimilar = allStacksObj[indexSimilar];
  8. const stackDifferent = allStacksObj[indexDifferent];
  9.  
  10. const meKeysDiff = Object.keys(stackMe).filter(
  11.   (k) => stackMe[k] === stackSimilar[k] && stackMe[k] !== stackDifferent[k]
  12. );
  13. const diffStackKeysDiff = Object.keys(stackDifferent).filter(
  14.   (k) => stackDifferent[k] !== stackMe[k] && stackDifferent[k] !== stackSimilar[k] && stackSimilar[k] === stackMe[k]
  15. );
  16. const allKeysDiff = new Set(meKeysDiff.concat(diffStackKeysDiff));
  17.  
  18. console.log(
  19.   'me: ',
  20.   stackMe.nametxt,
  21.   stackMe.x,
  22.   stackMe.y,
  23.   'similar: ',
  24.   stackSimilar.nametxt,
  25.   stackSimilar.x,
  26.   stackSimilar.y,
  27.   'different: ',
  28.   stackDifferent.nametxt,
  29.   stackDifferent.x,
  30.   stackDifferent.y,
  31.   allKeysDiff
  32. );
Advertisement
Add Comment
Please, Sign In to add comment