Skip to content

Commit 9ef8a87

Browse files
es128phated
authored andcommitted
feat: pre-process braces/brackets sections
Replace with simple * so that whatever path part they are in still gets recognized as containing glob magic
1 parent a24be03 commit 9ef8a87

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ var pathDirname = require('path-dirname');
66

77
module.exports = function globParent(str) {
88
str += 'a'; // preserves full path in case of trailing path separator
9+
// replace braces/brackets sections with *
10+
str = str.replace(/(^|[^\\])(\{([^{}]*?)}|\[([^\[\]]*?)\])/g, '$1*');
911
do {str = pathDirname.posix(str)} while (isglob(str));
1012
return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
1113
};

0 commit comments

Comments
 (0)