File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ module.exports = function globParent(str) {
13
13
14
14
// remove path parts that are globby
15
15
do { str = pathDirname . posix ( str ) }
16
- while ( isglob ( str ) || / ( ^ | [ ^ \\ ] ) [ \{ \[ ] / . test ( str ) ) ;
16
+ while ( isglob ( str ) || / ( ^ | [ ^ \\ ] ) ( [ \{ \[ ] | \( [ ^ \) ] + $ ) / . test ( str ) ) ;
17
17
18
18
// remove escape chars and return result
19
19
return str . replace ( / \\ ( [ \* \? \| \[ \] \( \) \{ \} ] ) / g, '$1' ) ;
Original file line number Diff line number Diff line change @@ -94,6 +94,9 @@ describe('glob-parent', function() {
94
94
assert . equal ( gp ( 'path/foo\\[a\\\/]/' ) , 'path/foo[a\\\/]' ) ;
95
95
assert . equal ( gp ( 'foo[a\\\/]' ) , '.' ) ;
96
96
assert . equal ( gp ( 'foo\\[a\\\/]' ) , 'foo[a\\\/]' ) ;
97
+ assert . equal ( gp ( 'path/(foo/bar|baz)' ) , 'path' ) ;
98
+ assert . equal ( gp ( 'path/(foo/bar|baz)/' ) , 'path' ) ;
99
+ assert . equal ( gp ( 'path/\\(foo/bar|baz)/' ) , 'path/(foo/bar|baz)' ) ;
97
100
} ) ;
98
101
99
102
it ( 'should handle nested braces' , function ( ) {
You can’t perform that action at this time.
0 commit comments