Skip to content

Commit

Permalink
fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Oct 31, 2019
1 parent 766bcb0 commit 9caca07
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ parse.fastpaths = (input, options) => {
}

const globstar = (opts) => {
if (opts.noglobstar === true) return star;
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};

Expand Down
14 changes: 14 additions & 0 deletions test/options.noglobstar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

require('mocha');
const assert = require('assert').strict;
const { isMatch } = require('..');

describe('options.noglobstar', () => {
it('should disable extglob support when options.noglobstar is true', () => {
assert(isMatch('a/b/c', '**', { noglobstar: false }));
assert(!isMatch('a/b/c', '**', { noglobstar: true }));
assert(isMatch('a/b/c', 'a/**', { noglobstar: false }));
assert(!isMatch('a/b/c', 'a/**', { noglobstar: true }));
});
});

0 comments on commit 9caca07

Please sign in to comment.