"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.dedupe = dedupe;
function dedupe() {
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var iteratee = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (p) {
    return p;
  };
  /**
              .,
    .      _,'f----.._
    |\ ,-'"/  |     ,'
    |,_  ,--.      /
    /,-. ,'`.     (_
    f  o|  o|__     "`-.
    ,-._.,--'_ `.   _.,-`
    `"' ___.,'` j,-'
      `-.__.,--'
    Gotta go fast!
  */

  var seen = new Set();
  list.forEach(function (l) {
    return seen.add(iteratee(l));
  });
  return list.filter(function (l) {
    var it = iteratee(l);
    if (seen.has(it)) {
      seen.delete(it);
      return true;
    }
    return false;
  });
}