DieselDepot-APP/node_modules/es-toolkit/dist/compat/array/uniq.mjs
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

24 lines
766 B
JavaScript

import { uniq as uniq$1 } from "../../array/uniq.mjs";
import { isArrayLike } from "../predicate/isArrayLike.mjs";
//#region src/compat/array/uniq.ts
/**
* Creates a duplicate-free version of an array.
*
* This function takes an array and returns a new array containing only the unique values
* from the original array, preserving the order of first occurrence.
*
* @template T - The type of elements in the array.
* @param arr - The array to process.
* @returns A new array with only unique values from the original array.
*
* @example
* const array = [1, 2, 2, 3, 4, 4, 5];
* const result = uniq(array);
* // result will be [1, 2, 3, 4, 5]
*/
function uniq(arr) {
if (!isArrayLike(arr)) return [];
return uniq$1(Array.from(arr));
}
//#endregion
export { uniq };