smart-array-filter
Version:
Filter an array of objects
23 lines • 899 B
TypeScript
import type { Json } from './utils/types';
interface OptionsTypeBase {
keywords?: string[] | string | null;
limit?: number;
caseSensitive?: boolean;
predicate?: Predicate;
ignorePaths?: Array<RegExp | string>;
includePaths?: Array<RegExp | string>;
pathAlias?: Record<string, string | RegExp>;
}
export type OptionsTypeWithIndex = OptionsTypeBase & {
index: true;
};
export type OptionsTypeWithoutIndex = OptionsTypeBase & {
index?: false;
};
export type OptionsType = OptionsTypeWithIndex | OptionsTypeWithoutIndex;
export type Predicate = 'AND' | 'OR';
export declare function filter(array: Json[], options?: OptionsTypeWithIndex): number[];
export declare function filter<T>(array: T[], options?: OptionsTypeWithoutIndex): T[];
export declare function filter<T>(array: T[], options?: OptionsType): T[] | number[];
export {};
//# sourceMappingURL=index.d.ts.map