UNPKG

@mcabreradev/filter

Version:

Filters an array based on the provided expression, a helper for complex array filtering

12 lines (11 loc) 407 B
/** * Filters an array based on the provided expression. * * @template T - The type of elements in the array. * @param {T[]} array - The array to filter. * @param {unknown} expression - The expression used for filtering. * @returns {T[]} - The filtered array. * @throws {Error} - If the input is not an array. */ declare const filter: <T>(array: T[], expression: any) => T[]; export default filter;