You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cdae91e
Browse filesBrowse the repository at this point in the historyBrowse files
* @typedef {object} PathObject Object of path information for a file matched by glob.
11
+
* @property {string} cwd The current working directory of the matcher.
12
+
* @property {string} base The non-magic portion of the glob that matched.
13
+
* @property {string} path The absolute file path to the file.
14
+
*/
15
+
16
+
/**
17
+
* @typedef {(p: PathObject) => unknown} UniqueByFunc A function used to provide a value of uniqueness.
18
+
*/
19
+
20
+
/**
21
+
* @typedef {object} Options Configuration for the glob-stream instance.
22
+
* @property {"cwd" | "base" | "path" | UniqueByFunc} [uniqueBy] A property or function to determine uniqueness of a {@link PathObject} - defaults to `"path"`.
23
+
* @property {string} [cwd] The current working directory - defaults to `process.cwd()`.
24
+
* @property {boolean} [cwdbase] If `true`, the `cwd` value will be used as the `base` on {@link PathObject}.
25
+
* @property {string} [base] A hardcoded `base` to use on each {@link PathObject}.
26
+
* @property {string | string[]} [ignore] Paths or globs for the glob instance to exclude.
27
+
* @property {string | string[]} [exclude] Paths or globs for the glob instance to exclude.
28
+
*/
29
+
30
+
/**
31
+
* Validates that all items in an array are strings and at least
32
+
* one isn't a negative glob (doesn't start with a `!`).
33
+
*
34
+
* @param {unknown[]} globs The glob array to validate.
35
+
* @returns {asserts globs is string[]}
36
+
*/
8
37
functionvalidateGlobs(globs){
9
38
lethasPositiveGlob=false;
10
39
@@ -23,14 +52,31 @@ function validateGlobs(globs) {
23
52
}
24
53
}
25
54
55
+
/**
56
+
* Determines if a glob starts with `!`.
57
+
*
58
+
* @param {string} glob The glob string to check.
59
+
* @returns `true` if the glob string starts with ! or `false` otherwise.
60
+
*/
26
61
functionisNegatedGlob(glob){
27
62
returnglob.startsWith("!");
28
63
}
29
64
65
+
/**
66
+
* Determines if a glob does not start with a `!`.
67
+
*
68
+
* @param {string} glob The glob string to check.
69
+
* @returns `true` if the glob does not start with `!` or `false` otherwise.
70
+
*/
30
71
functionisPositiveGlob(glob){
31
72
return!isNegatedGlob(glob);
32
73
}
33
74
75
+
/**
76
+
* Validates the `uniqueBy` option is of the allowed types.
0 commit comments