/** * This function returns a copy of the array that you pass to it, but with all * duplicates removed. * * WARNING: If the array contains NaN, it will be removed. * * @example * unique(["apple", "apple", "banana", "cherry", "banana", NaN, NaN]); * // Returns ["apple", "banana", "cherry"] */ export default function unique(array: any[]): any[] { return array.filter((e: any, i: any, a: string | any[]) => { return a.indexOf(e) === i; }); }