-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Replace indexOf with includes #1264
Replace indexOf with includes #1264
Conversation
Changed the relevant if statement to an early return.
index.js
Outdated
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) { | ||
// e.g. --inspect=localhost:1234 | ||
debugOption = match[1]; | ||
if (!arg.includes('--inspect')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better as !arg.startsWith
rather than !arg.includes
to match the intent of arg.indexOf === 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
I'm sure you're right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One suggested change. Replacing the use of indexOf which require some thought for more meaningful calls is good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
Pull Request
Problem
There was some code that was easier to understand using 'includes' than 'indexOf'.
Solution
ChangeLog