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

refactor: use replaceAll() instead of eval() #550

Merged
merged 1 commit into from
Aug 21, 2023
Merged

refactor: use replaceAll() instead of eval() #550

merged 1 commit into from
Aug 21, 2023

Conversation

yin1999
Copy link
Contributor

@yin1999 yin1999 commented Aug 21, 2023

eval() is slower than the alternatives, and it is also unsafe. Using template string instead to avoid eval() calls.

reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!

`eval()` is slower than the alternatives, and it is also unsafe.
Using template string instead to avoid `eval()` calls.
@windingwind windingwind merged commit 1a605fb into windingwind:main Aug 21, 2023
@yin1999 yin1999 deleted the replace-eval branch August 21, 2023 15:19
@volatile-static
Copy link
Contributor

或许可以使用一些格式化字符串的库?

@yin1999
Copy link
Contributor Author

yin1999 commented Aug 22, 2023

没有被大量使用,感觉没这个必要性

@windingwind
Copy link
Owner

依赖越多风险越大,尽量少外部依赖

Copy link

github-actions bot commented Jul 6, 2024

🚀 This ticket has been resolved in v1.1.0-beta.50. See Release v1.1.0-beta.50 for release notes.

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.

3 participants