UNPKG

typescript-array-utils

Version:
15 lines (14 loc) 410 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var identityCompare = function (a, b) { return a === b; }; function unique(arr, compare) { if (compare === void 0) { compare = identityCompare; } return arr.filter(function (e, index) { return index === arr.findIndex(function (v) { return compare(e, v); }); }); } exports.unique = unique;