Skip to content

Commit

Permalink
Merge pull request #50 from micromatch/phated/keep-trailing-sep
Browse files Browse the repository at this point in the history
fix: Keep trailing slash on paths
  • Loading branch information
paulmillr committed Nov 20, 2022
2 parents 0aeecc2 + 24c4b51 commit 0b8c2f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const matchPatterns = (patterns, negPatterns, args, returnIndex) => {
throw new TypeError('anymatch: second argument must be a string: got ' +
Object.prototype.toString.call(_path))
}
const path = normalizePath(_path);
const path = normalizePath(_path, false);

for (let index = 0; index < negPatterns.length; index++) {
const nglob = negPatterns[index];
Expand Down
3 changes: 3 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ describe('anymatch', () => {
assert.equal(false, anymatch(emptyObj, ''));
assert.equal(false, anymatch(Infinity, ''));
});
it('should keep trailing separators on paths to match /*/ globs', () => {
assert.equal(true, anymatch('path/to/*/', 'path/to/dir/'));
});

describe('with returnIndex = true', () => {
it('should return the array index of first positive matcher', () => {
Expand Down

0 comments on commit 0b8c2f6

Please sign in to comment.