@naverpay/hidash
Version:
improved lodash
19 lines (16 loc) • 969 B
TypeScript
import { List } from './internal/types.js';
import { ValueIteratee } from './internal/baseIteratee.type.js';
/**
* @description
* Creates a duplicate-free version of an array. Uniqueness of elements is determined by
* the result of passing each element to the `iteratee` function.
* The order of result values is determined by the order they occur in the original array.
* This function is similar to lodash's `uniqBy`.
*
* @param {List<T> | null | undefined} array - The array to inspect. If null, undefined, or not an array-like object, an empty array is returned.
* @param {ValueIteratee<T>} iteratee - The function invoked per element to generate the criterion for uniqueness.
* It receives three arguments: (value: T, index: number, collection: List<T>).
* @returns {T[]} Returns the new array of unique elements.
*/
declare function uniqBy<T>(array: List<T> | null | undefined, iteratee: ValueIteratee<T>): T[];
export { uniqBy as default, uniqBy };