Skip to content

Commit

Permalink
fix: Keep trailing slash on paths
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Nov 19, 2022
1 parent 0aeecc2 commit 24c4b51
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 24c4b51

Please sign in to comment.