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

Could further reduce .length > 0 checks #23

Open
daveisfera opened this issue Mar 11, 2020 · 2 comments
Open

Could further reduce .length > 0 checks #23

daveisfera opened this issue Mar 11, 2020 · 2 comments

Comments

@daveisfera
Copy link
Contributor

Thanks once again for this saaaaweeeet codemod!

This line of code item && item.props && item.props.data && item.props.data.length > 0 is reduced to two statementsitem?.props?.data && item.props.data.length > 0 but it could be reduced to a single statement item?.props?.data?.length > 0

@villesau
Copy link
Owner

Indeed! Good catch! I think > changes the semantics of the AST so that item.props.data.length and > are grouped together which causes it to be left out from the transformation. This might be a bit tricky to solve.

@daveisfera
Copy link
Contributor Author

Ya, I figured that that might be case. It definitely would be nice to clean up, but isn't a major concern right now.

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

No branches or pull requests

2 participants