Skip to content

Commit f8145c5

Browse files
frandioxisaacs
authored andcommitted
Add 'allowWindowsEscape' option
PR-URL: #103 Credit: @frandiox Close: #103 Reviewed-by: @isaacs
1 parent 570e8b1 commit f8145c5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d
187187
minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a
188188
```
189189

190+
### allowWindowsEscape
191+
192+
Windows path separator `\` is by default converted to `/`, which
193+
prohibits the usage of `\` as a escape character. This flag skips that
194+
behavior and allows using the escape character.
195+
190196
## Comparisons to other fnmatch/glob implementations
191197

192198
While strict compliance with the existing standards is a worthwhile

minimatch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function Minimatch (pattern, options) {
135135
if (!options) options = {}
136136

137137
// windows support: need to use /, not \
138-
if (path.sep !== '/') {
138+
if (!options.allowWindowsEscape && path.sep !== '/') {
139139
pattern = pattern.split(path.sep).join('/')
140140
}
141141

0 commit comments

Comments
 (0)