SortedList.prototype.unique = function()

in src/lib/sortedList.js [167:180]


SortedList.prototype.unique = function(createNew) {
  if (createNew) return this.filter(function(v, k) {
    return k == 0 || this._compare(this[k-1], v) != 0;
  }, this);
  var total = 0;
  this.map(function(v, k) {
    if (k == 0 || this._compare(this[k-1], v) != 0) return null;
    return k - (total++);
  }, this)
  .forEach(function(k) {
    if (k != null) this.remove(k);
  }, this);
  return this;
};