es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
11 lines (10 loc) • 358 B
TypeScript
/**
* Returns a new array with duplicate elements removed.
* @param {T[]} array - The array to remove duplicates from.
* @returns {T[]} A new array containing only unique elements.
* @template T
* @example
* const arr = [1, 2, 2, 3, 4, 4, 5];
* const uniqueArr = unique(arr); // [1, 2, 3, 4, 5]
*/
export declare function unique<T>(array: T[]): T[];