code: function(a, b) {
      if (a.pos < b.pos) return -1;
      if (a.pos > b.pos) return 1;
  
      if (a.mode < b.mode) return -1;
      if (a.mode > b.mode) return 1;
  
      if (a.mode === ENTER) {
        if (a.level < b.level) return -1;
        if (a.level > b.level) return 1;
      }
  
      if (a.mode === EXIT) {
        if (a.level > b.level) return -1;
        if (a.level < b.level) return 1;
      }
  
      return 0;
    }
docs: Orders sweep events according to following precedences:  1. pos 2. EXIT < ENTER 3. if both ENTER: ascending level 4. if both EXIT: descending level