Skip to content

Commit

Permalink
feat: make basename/wholename specifier optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Mar 21, 2023
1 parent 3145a4b commit fe845ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/testExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const testExpression = (expression: Expression, fileName: string) => {
if (name === 'match' || name === 'imatch') {
const pattern = expression[1];
const subject =
expression[2] === 'basename' ? path.basename(fileName) : fileName;
expression[2] === 'wholename' ? fileName : path.basename(fileName);

return micromatch.isMatch(subject, pattern, {
dot: true,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type Expression =
| ['dirname' | 'idirname', string]
// Evaluates as true if a glob matches against the basename of the file.
// https://facebook.github.io/watchman/docs/expr/match.html
| ['match' | 'imatch', string]
| ['match' | 'imatch', string, 'basename' | 'wholename']
// Evaluates as true if the sub-expression evaluated as false, i.e. inverts the sub-expression.
// https://facebook.github.io/watchman/docs/expr/not.html
Expand Down

0 comments on commit fe845ec

Please sign in to comment.