Skip to content

Commit

Permalink
Merge pull request #32 from ammarnajjar/bugifx/fix-actions-exact-matc…
Browse files Browse the repository at this point in the history
…hing-regex

fix actions exact matching regex
  • Loading branch information
ammarnajjar authored Dec 23, 2022
2 parents 4085f32 + 41bb090 commit 4244069
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ export class Generator {
actions = [
...actions,
...this.allActions.filter((action: string) =>
// eslint-disable-next-line no-useless-escape
mapNode.getText().match(new RegExp(`[^\w]${action}\\(`)),
mapNode.getText().match(new RegExp(`[^\\w]${action}\\(`)),
),
];
}
Expand Down Expand Up @@ -190,12 +189,9 @@ export class Generator {
actions = [
...actions,
...this.allActions.filter((action: string) => {
return (
callable
.getText()
// eslint-disable-next-line no-useless-escape
.match(new RegExp(`[^\w]${action}[^\w]`))
);
return callable
.getText()
.match(new RegExp(`[^\\w]${action}[^\\w]`));
}),
];
}
Expand Down Expand Up @@ -249,7 +245,8 @@ export class Generator {
...new Set(
this.allActions.filter(
(action: string) =>
nodes.filter(node => node.includes(action)).length,
nodes.filter(node => node.match(new RegExp(`[^\\w]${action}\\(`)))
.length,
),
),
];
Expand Down

0 comments on commit 4244069

Please sign in to comment.