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 eb78791
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: index.d.ts
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,28 @@ export type Options = {
63
63
*/
64
64
readonlyignoreFiles?: string|readonlystring[];
65
65
66
+
/**
67
+
When only negation patterns are provided (e.g., `['!*.json']`), automatically prepend a catch-all pattern (`**\/*`) to match all files before applying negations.
68
+
69
+
Set to `false` to return an empty array when only negation patterns are provided. This can be useful when patterns are user-controlled, to avoid unexpectedly matching all files.
70
+
71
+
@default true
72
+
73
+
@example
74
+
```
75
+
import {globby} from 'globby';
76
+
77
+
// Default behavior: matches all files except .json
Copy file name to clipboardExpand all lines: readme.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,6 +106,27 @@ This is a more generic form of the `gitignore` option, allowing you to find igno
106
106
107
107
**Performance tip:** Using a specific path like `'.gitignore'` is much faster than recursive patterns.
108
108
109
+
##### expandNegationOnlyPatterns
110
+
111
+
Type: `boolean`\
112
+
Default: `true`
113
+
114
+
When only negation patterns are provided (e.g., `['!*.json']`), automatically prepend a catch-all pattern (`**/*`) to match all files before applying negations.
115
+
116
+
Set to `false` to return an empty array when only negation patterns are provided. This can be useful when patterns are user-controlled, to avoid unexpectedly matching all files.
117
+
118
+
```js
119
+
import {globby} from'globby';
120
+
121
+
// Default behavior: matches all files except .json
0 commit comments