[6a3a178] | 1 | type Pathname = string
|
---|
| 2 |
|
---|
| 3 | interface TestResult {
|
---|
| 4 | ignored: boolean
|
---|
| 5 | unignored: boolean
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | export interface Ignore {
|
---|
| 9 | /**
|
---|
| 10 | * Adds a rule rules to the current manager.
|
---|
| 11 | * @param {string | Ignore} pattern
|
---|
| 12 | * @returns IgnoreBase
|
---|
| 13 | */
|
---|
| 14 | add(pattern: string | Ignore): this
|
---|
| 15 | /**
|
---|
| 16 | * Adds several rules to the current manager.
|
---|
| 17 | * @param {string[]} patterns
|
---|
| 18 | * @returns IgnoreBase
|
---|
| 19 | */
|
---|
| 20 | add(patterns: (string | Ignore)[]): this
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Filters the given array of pathnames, and returns the filtered array.
|
---|
| 24 | * NOTICE that each path here should be a relative path to the root of your repository.
|
---|
| 25 | * @param paths the array of paths to be filtered.
|
---|
| 26 | * @returns The filtered array of paths
|
---|
| 27 | */
|
---|
| 28 | filter(pathnames: Pathname[]): Pathname[]
|
---|
| 29 | /**
|
---|
| 30 | * Creates a filter function which could filter
|
---|
| 31 | * an array of paths with Array.prototype.filter.
|
---|
| 32 | */
|
---|
| 33 | createFilter(): (pathname: Pathname) => boolean
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * Returns Boolean whether pathname should be ignored.
|
---|
| 37 | * @param {string} pathname a path to check
|
---|
| 38 | * @returns boolean
|
---|
| 39 | */
|
---|
| 40 | ignores(pathname: Pathname): boolean
|
---|
| 41 |
|
---|
| 42 | /**
|
---|
| 43 | * Returns whether pathname should be ignored or unignored
|
---|
| 44 | * @param {string} pathname a path to check
|
---|
| 45 | * @returns TestResult
|
---|
| 46 | */
|
---|
| 47 | test(pathname: Pathname): TestResult
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | interface Options {
|
---|
| 51 | ignorecase?: boolean
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | /**
|
---|
| 55 | * Creates new ignore manager.
|
---|
| 56 | */
|
---|
| 57 | declare function ignore(options?: Options): Ignore
|
---|
| 58 |
|
---|
| 59 | declare namespace ignore {
|
---|
| 60 | export function isPathValid (pathname: string): boolean
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | export default ignore
|
---|