UNPKG

pockybot

Version:

Spark bot that handles team recognition

19 lines (18 loc) 634 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.distinct = void 0; function distinct(array, comparator) { if (comparator) { return distinctWithComparator(array, comparator); } else { return distinctWithoutComparator(array); } } exports.distinct = distinct; function distinctWithComparator(array, comparator) { return array.sort(comparator).filter((value, index, array) => index === 0 || comparator(value, array[index - 1]) !== 0); } function distinctWithoutComparator(array) { return array.filter((value, index, array) => index === array.indexOf(value)); }