aboutsummaryrefslogtreecommitdiff
path: root/_mint/node_modules/editorconfig/src/lib/fnmatch.d.ts
blob: 5c9bd38a28fca1adbc123792d2eaf0f59875b3fb (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// Type definitions for Minimatch 3.0
// Project: https://github.com/isaacs/minimatch
// Definitions by: vvakame <https://github.com/vvakame>
//                 Shant Marouti <https://github.com/shantmarouti>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/**
 * Tests a path against the pattern using the options.
 */
declare function M(target: string, pattern: string, options?: M.IOptions): boolean;

declare namespace M {
    /**
     * Match against the list of files, in the style of fnmatch or glob.
     * If nothing is matched, and options.nonull is set,
     * then return a list containing the pattern itself.
     */
    function match(list: string[], pattern: string, options?: IOptions): string[];

    /**
     * Returns a function that tests its supplied argument, suitable for use with Array.filter
     */
    function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean;

    /**
     * Make a regular expression object from the pattern.
     */
    function makeRe(pattern: string, options?: IOptions): RegExp;

    var Minimatch: IMinimatchStatic;

    interface IOptions {
        /**
         * Dump a ton of stuff to stderr.
         *
         * @default false
         */
        debug?: boolean;

        /**
         * Do not expand {a,b} and {1..3} brace sets.
         *
         * @default false
         */
        nobrace?: boolean;

        /**
         * Disable ** matching against multiple folder names.
         *
         * @default false
         */
        noglobstar?: boolean;

        /**
         * Allow patterns to match filenames starting with a period,
         * even if the pattern does not explicitly have a period in that spot.
         *
         * @default false
         */
        dot?: boolean;

        /**
         * Disable "extglob" style patterns like +(a|b).
         *
         * @default false
         */
        noext?: boolean;

        /**
         * Perform a case-insensitive match.
         *
         * @default false
         */
        nocase?: boolean;

        /**
         * When a match is not found by minimatch.match,
         * return a list containing the pattern itself if this option is set.
         * Otherwise, an empty list is returned if there are no matches.
         *
         * @default false
         */
        nonull?: boolean;

        /**
         * If set, then patterns without slashes will be matched against
         * the basename of the path if it contains slashes.
         *
         * @default false
         */
        matchBase?: boolean;

        /**
         * Suppress the behavior of treating #
         * at the start of a pattern as a comment.
         *
         * @default false
         */
        nocomment?: boolean;

        /**
         * Suppress the behavior of treating a leading ! character as negation.
         *
         * @default false
         */
        nonegate?: boolean;

        /**
         * Returns from negate expressions the same as if they were not negated.
         * (Ie, true on a hit, false on a miss.)
         *
         * @default false
         */
        flipNegate?: boolean;
    }

    interface IMinimatchStatic {
        new(pattern: string, options?: IOptions): IMinimatch;
        prototype: IMinimatch;
    }

    interface IMinimatch {
        /**
         * The original pattern the minimatch object represents.
         */
        pattern: string;

        /**
         * The options supplied to the constructor.
         */
        options: IOptions;

        /**
         * A 2-dimensional array of regexp or string expressions.
         */
        set: any[][]; // (RegExp | string)[][]

        /**
         * A single regular expression expressing the entire pattern.
         * Created by the makeRe method.
         */
        regexp: RegExp;

        /**
         * True if the pattern is negated.
         */
        negate: boolean;

        /**
         * True if the pattern is a comment.
         */
        comment: boolean;

        /**
         * True if the pattern is ""
         */
        empty: boolean;

        /**
         * Generate the regexp member if necessary, and return it.
         * Will return false if the pattern is invalid.
         */
        makeRe(): RegExp; // regexp or boolean

        /**
         * Return true if the filename matches the pattern, or false otherwise.
         */
        match(fname: string): boolean;

        /**
         * Take a /-split filename, and match it against a single row in the regExpSet.
         * This method is mainly for internal use, but is exposed so that it can be used
         * by a glob-walker that needs to avoid excessive filesystem calls.
         */
        matchOne(files: string[], pattern: string[], partial: boolean): boolean;

        /**
         * Deprecated. For internal use.
         *
         * @private
         */
        debug(): void;

        /**
         * Deprecated. For internal use.
         *
         * @private
         */
        make(): void;

        /**
         * Deprecated. For internal use.
         *
         * @private
         */
        parseNegate(): void;

        /**
         * Deprecated. For internal use.
         *
         * @private
         */
        braceExpand(pattern: string, options: IOptions): void;

        /**
         * Deprecated. For internal use.
         *
         * @private
         */
        parse(pattern: string, isSub?: boolean): void;
    }
}

export = M;