Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ function getInstallPackage(version) {
function getPackageName(installPackage) {
if (~installPackage.indexOf('.tgz')) {
Copy link
Contributor

@gaearon gaearon Oct 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please kill ~ on this line as well? It is the kind of "clever code" that is extremely confusing 😄 . I missed it when I reviewed the change adding it.

return installPackage.match(/^.+\/(.+)-.+\.tgz$/)[1];
} else if (~installPackage.indexOf('@')) {
return installPackage.split('@')[0];
} else if (installPackage.indexOf('@') > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a comment because somebody else might change it to -1 later without understanding the reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will do.

return installPackage.charAt(0) + installPackage.substr(1).split('@')[0];
}
return installPackage;
}
Expand Down