astx
astx copied to clipboard
refactor: find: rm useless condition
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 https://github.com/coderaiser/putout/commit/c08ec496d62fe1786d2f9031d4957789c3e28cb9
Actually this was a bug and the else condition should be [matcher.nodeType]. Weird that I missed this...
There is more such cases, you can find them with putout :). Static analysis can’t be to much.