main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[d565449] | 1 | type Pathname = string
|
---|
| 2 |
|
---|
| 3 | interface TestResult {
|
---|
| 4 | ignored: boolean
|
---|
| 5 | unignored: boolean
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | export interface Ignore {
|
---|
| 9 | /**
|
---|
| 10 | * Adds one or several rules to the current manager.
|
---|
| 11 | * @param {string[]} patterns
|
---|
| 12 | * @returns IgnoreBase
|
---|
| 13 | */
|
---|
| 14 | add(patterns: string | Ignore | readonly (string | Ignore)[]): this
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | * Filters the given array of pathnames, and returns the filtered array.
|
---|
| 18 | * NOTICE that each path here should be a relative path to the root of your repository.
|
---|
| 19 | * @param paths the array of paths to be filtered.
|
---|
| 20 | * @returns The filtered array of paths
|
---|
| 21 | */
|
---|
| 22 | filter(pathnames: readonly Pathname[]): Pathname[]
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * Creates a filter function which could filter
|
---|
| 26 | * an array of paths with Array.prototype.filter.
|
---|
| 27 | */
|
---|
| 28 | createFilter(): (pathname: Pathname) => boolean
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * Returns Boolean whether pathname should be ignored.
|
---|
| 32 | * @param {string} pathname a path to check
|
---|
| 33 | * @returns boolean
|
---|
| 34 | */
|
---|
| 35 | ignores(pathname: Pathname): boolean
|
---|
| 36 |
|
---|
| 37 | /**
|
---|
| 38 | * Returns whether pathname should be ignored or unignored
|
---|
| 39 | * @param {string} pathname a path to check
|
---|
| 40 | * @returns TestResult
|
---|
| 41 | */
|
---|
| 42 | test(pathname: Pathname): TestResult
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | export interface Options {
|
---|
| 46 | ignorecase?: boolean
|
---|
| 47 | // For compatibility
|
---|
| 48 | ignoreCase?: boolean
|
---|
| 49 | allowRelativePaths?: boolean
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | /**
|
---|
| 53 | * Creates new ignore manager.
|
---|
| 54 | */
|
---|
| 55 | declare function ignore(options?: Options): Ignore
|
---|
| 56 |
|
---|
| 57 | declare namespace ignore {
|
---|
| 58 | export function isPathValid (pathname: string): boolean
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | export default ignore
|
---|
Note:
See
TracBrowser
for help on using the repository browser.