Skip to content

Commit

Permalink
Fixed issue where isIdentifier confirms invalid identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ariel Grunfeld committed Sep 13, 2022
1 parent 5e6fe06 commit 0006676
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/shared/type-predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export const isNumericString = (x: string): boolean => JSON.stringify(+x) === x;
// A predicate for a valid identifier
export type Identifier = string;
export const isIdentifier = (x: any): x is Identifier =>
/[A-Za-z][A-Za-z0-9]*/i.test(x);
/^[A-Za-z][A-Za-z0-9]*/i.test(x);

0 comments on commit 0006676

Please sign in to comment.