-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input regexp #2
input regexp #2
Conversation
i didn't test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR.
However, this has a compile error.
Would you fix it?
src/index.ts
Outdated
options?: RegExpParser.Options, | ||
): AST.RegExpLiteral { | ||
return new RegExpParser(options).parseLiteral(source) | ||
return new RegExpParser(options).parseLiteral(source instanceof RegExp ? `/${source.source}/${source.flags}` : source) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`/${source.source}/${source.flags}`
This is exact what RegExp#toString()
does. I think you can use String(source)
merely.
src/index.ts
Outdated
export function parseRegExpLiteral( | ||
source: string, | ||
export function parseRegExpLiteral<T>( | ||
source: T extends RegExp ? RegExp : string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that <T>
is redundant. You can use source: string | RegExp,
.
* mysticatea/master: 2.0.1 Fix: follow tc39/ecma262#910 (refs eslint/eslint#10861) 2.0.0 2.0.0-beta.0 Update: Unicode version to 11 Breaking: replace Disjunction node by Alternative node Docs: update README.md Chore: trivial Chore: follow up mysticatea#2 Update: parseRegExpLiteral supports RegExp object Chore: coverage Chore: upgrade deps Fix: location of quantifier (fixes mysticatea#3) New: add visitor Chore: update eslint config Breaking: drop Node.js 4 support # Conflicts: # .eslintignore # .eslintrc.yml # package.json # src/index.ts # src/parser.ts # test/fixtures/parser/literal.ts # tsconfig.json
i didn't test