Skip to content

Commit

Permalink
Add 'allowWindowsEscape' option
Browse files Browse the repository at this point in the history
PR-URL: #103
Credit: @frandiox
Close: #103
Reviewed-by: @isaacs
  • Loading branch information
frandiox authored and isaacs committed Feb 13, 2022
1 parent 570e8b1 commit f8145c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d
minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a
```

### allowWindowsEscape

Windows path separator `\` is by default converted to `/`, which
prohibits the usage of `\` as a escape character. This flag skips that
behavior and allows using the escape character.

## Comparisons to other fnmatch/glob implementations

While strict compliance with the existing standards is a worthwhile
Expand Down
2 changes: 1 addition & 1 deletion minimatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function Minimatch (pattern, options) {
if (!options) options = {}

// windows support: need to use /, not \
if (path.sep !== '/') {
if (!options.allowWindowsEscape && path.sep !== '/') {
pattern = pattern.split(path.sep).join('/')
}

Expand Down

0 comments on commit f8145c5

Please sign in to comment.