generated from JS-DevTools/template-node-typescript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfile-path-filter.ts
30 lines (26 loc) · 1.25 KB
/
file-path-filter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { createFilter } from "./create-filter";
import { AnyFilter, FilterCriterion, FilterFunction, Filters } from "./types";
/**
* Creates a `FilterFunction` that matches file paths based on the specified criteria.
*
* @param criteria - One or more glob patterns, regular expressions, or filter functions
* @returns A `FilterFunction` that matches file paths based on the specified criteria
*/
export function filePathFilter(criteria: AnyFilter): FilterFunction;
/**
* Creates a `FilterFunction` that matches file paths based on the specified criteria.
*
* @param criteria - One or more glob patterns, regular expressions, or filter functions
* @returns A `FilterFunction` that matches file paths based on the specified criteria
*/
export function filePathFilter(...criteria: FilterCriterion[]): FilterFunction;
/**
* Creates a `FilterFunction` that matches file paths based on the specified criteria.
*
* @param filters - An object with `include` and `exclude` filter criteria
* @returns A `FilterFunction` that matches file paths based on the specified criteria
*/
export function filePathFilter(filters: Filters): FilterFunction;
export function filePathFilter(...args: unknown[]): FilterFunction {
return createFilter({}, ...args as FilterCriterion[]);
}