only return true if both open and close brace exist https://github.com/jonschlinkert/is-glob/issues/4#issuecomment-244562020
This commit is contained in:
parent
2f993202b5
commit
733822f4af
2 changed files with 7 additions and 1 deletions
2
index.js
2
index.js
|
|
@ -11,7 +11,7 @@ module.exports = function isExtglob(str) {
|
|||
}
|
||||
|
||||
var m, matches = [];
|
||||
while ((m = /(\\).|([@?!+*]\()/g.exec(str))) {
|
||||
while ((m = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
|
||||
if (m[2]) matches.push(m[2]);
|
||||
str = str.slice(m.index + m[0].length);
|
||||
}
|
||||
|
|
|
|||
6
test.js
6
test.js
|
|
@ -31,6 +31,12 @@ describe('isExtglob', function () {
|
|||
});
|
||||
|
||||
it('should not match escaped extglobs', function () {
|
||||
assert(!isExtglob('?(abc/xyz'));
|
||||
assert(!isExtglob('@(abc'));
|
||||
assert(!isExtglob('!(abc'));
|
||||
assert(!isExtglob('*(abc'));
|
||||
assert(!isExtglob('+(abc'));
|
||||
assert(!isExtglob('(a|b'));
|
||||
assert(!isExtglob('\\?(abc)'));
|
||||
assert(!isExtglob('\\@(abc)'));
|
||||
assert(!isExtglob('\\!(abc)'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue