Skip to content
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

fix: manually test global regex codeframeRE index #1608

Merged
merged 1 commit into from
Jan 20, 2021

Conversation

clarkdo
Copy link
Contributor

@clarkdo clarkdo commented Jan 20, 2021

codeframeRE.test may return false incorrectly, because codeframeRE has the g flag and the search may begin from middle of string after first time calling test. This pr is manually resetting the index before test gets called

const pattern = /^foo/g
pattern.test('foo') // true
pattern.test('foo') // false

@yyx990803 yyx990803 merged commit 20d6c0f into vitejs:main Jan 20, 2021
@clarkdo clarkdo deleted the fix/codeframeRE branch January 20, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants