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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: find: rm useless condition #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

coderaiser
Copy link

@coderaiser coderaiser commented Apr 9, 2021

Both parts of expression:

const nodeTypes = Array.isArray(matcher.nodeType)
    ? matcher.nodeType
    : matcher.nodeType

Returns same result, and can be simplified to:

matcher.nodeType

Just landed this case to @putout/plugin-simplify-ternary 馃帀
With commit coderaiser/putout@c08ec49

@jedwards1211
Copy link
Contributor

Actually this was a bug and the else condition should be [matcher.nodeType]. Weird that I missed this...

@coderaiser
Copy link
Author

There is more such cases, you can find them with putout :). Static analysis can鈥檛 be to much.

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