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

prefer-math-trunc: Add match for parseInt(String(num), 10) #2514

Open
omril1 opened this issue Dec 19, 2024 · 0 comments
Open

prefer-math-trunc: Add match for parseInt(String(num), 10) #2514

omril1 opened this issue Dec 19, 2024 · 0 comments

Comments

@omril1
Copy link

omril1 commented Dec 19, 2024

Description

This should match as well since parseInt ignores the fraction part

Fail

const num = 37.4;
const truncated = parseInt(String(num)), 10);

Pass

const um = 37.4;
const truncated = Math.trunc(num);

Additional Info

No response

@sindresorhus sindresorhus changed the title prefer-math-trun: Add match for parseInt(String(num), 10) prefer-math-trunc: Add match for parseInt(String(num), 10) Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant