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

feat: introduce createIsLiteralPositionAcorn function #2

Merged
merged 1 commit into from Sep 12, 2022

Conversation

sapphi-red
Copy link
Sponsor Contributor

Description

Instead of creating a stripped string, it's more performant to make a function that returns whether a position is in literal.

This PR introduces createIsLiteralPositionAcorn function.
It can be used like this:
https://github.com/sapphi-red/strip-literal/blob/17cc35aceb088883a6e6d6ef8f388dc05885c6a8/bench/index.bench.ts#L105-L108

benchmark result
image
code: https://github.com/sapphi-red/strip-literal/blob/17cc35aceb088883a6e6d6ef8f388dc05885c6a8/bench/index.bench.ts
replace-non-literal(acorn) is the one using createIsLiteralPositionAcorn.

Linked Issues

Additional context

I'm not sure how README should be changed.

@antfu antfu merged commit d4af0b5 into antfu:main Sep 12, 2022
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.

None yet

2 participants