code: function(sort, antiStabilize) {
      return function(a, b) {
        var unstableResult = sort(a.td, b.td);
  
        if (unstableResult === 0) {
          if (antiStabilize) return b.index - a.index;
          return a.index - b.index;
        }
  
        return unstableResult;
      };
    }
docs: Stable sort function If two elements are equal under the original sort function, then there relative order is reversed