UNPKG

@mcabreradev/filter

Version:

A powerful, SQL-like array filtering library for TypeScript and JavaScript with advanced pattern matching, MongoDB-style operators, deep object comparison, and zero dependencies

14 lines (13 loc) 381 B
import { useMemo } from 'react'; import { filter as filterFn } from '../../core'; export const useFilterCore = (d, e, o) => useMemo(() => { if (!d?.length) return []; try { return filterFn(d, e, o); } catch { return []; } }, [d, e, o]); export const useIsFiltering = (f, d) => useMemo(() => f.length !== d.length, [f.length, d.length]);