UNPKG

3.12 kBTypeScriptView Raw
1// Type definitions for globule 1.1
2// Project: https://github.com/cowboy/node-globule
3// Definitions by: Dusan Radovanovic <https://github.com/durad>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6import minimatch = require('minimatch');
7import glob = require('glob');
8
9interface FindOptions extends glob.IOptions {
10 src?: string | undefined;
11 filter?: string | ((filepath?: string, options?: any) => boolean) | undefined;
12 nonull?: boolean | undefined;
13 matchBase?: boolean | undefined;
14 srcBase?: string | undefined;
15 prefixBase?: boolean | undefined;
16}
17
18interface MappingOptions extends FindOptions {
19 srcBase?: string | undefined;
20 destBase?: string | undefined;
21 ext?: string | undefined;
22 extDot?: 'first' | 'last' | undefined;
23 flatten?: boolean | undefined;
24 rename?(p: string): string;
25}
26
27interface OneMapping {
28 src: string[];
29 dest: string;
30}
31
32interface GlobuleStatic {
33 /**
34 * Match one or more globbing patterns against one or more file paths.
35 * Returns a uniqued array of all file paths that match any of the specified globbing patterns.
36 */
37 match(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): string[];
38
39 /**
40 * Tests pattern(s) against against one or more file paths and returns true if any files were matched, otherwise false.
41 */
42 isMatch(patterns: string | string[], filepaths: string | string[], options?: minimatch.IOptions): boolean;
43
44 /**
45 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
46 */
47 find(pattern: string | string[], options?: FindOptions): string[];
48
49 /**
50 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
51 */
52 find(options: FindOptions): string[];
53
54 /**
55 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
56 */
57 find(pattern: string | string[], pattern2: string | string[], options?: FindOptions): string[];
58
59 /**
60 * Returns a unique array of all file or directory paths that match the given globbing pattern(s)
61 */
62 find(pattern: string, pattern2: string, pattern3: string | string[], options?: FindOptions): string[];
63
64 /**
65 * Given a set of source file paths, returns an array of src-dest file mapping objects
66 */
67 mapping(filepaths: string[], options?: MappingOptions): OneMapping[];
68
69 /**
70 * Given a set of source file paths, returns an array of src-dest file mapping objects
71 */
72 mapping(options: MappingOptions): OneMapping[];
73
74 /**
75 * Given a set of source file paths, returns an array of src-dest file mapping objects
76 */
77 mapping(filepaths: string[], filepaths2: string[], options?: MappingOptions): OneMapping[];
78
79 /**
80 * Given a set of source file paths, returns an array of src-dest file mapping objects
81 */
82 mapping(filepaths: string[], filepaths2: string[], filepaths3: string[], options?: MappingOptions): OneMapping[];
83}
84
85declare var globule: GlobuleStatic;
86export = globule;
87
\No newline at end of file