GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||
GeezerVison is showing github.com — assert: remove code that is never reached by Trott · Pull Request #8132 · nodejs/node Conversation
Member
Checklist
Affected core subsystem(s)assert Description of changeThe internal function Therefore, we can remove the check in
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string.
|
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There appears to be some Ci infrastructure issues right now...will try again later, but the results look fine on the hosts that didn't have build issues. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } else { | ||
| return s; | ||
| } | ||
| return s.length < n ? s : s.slice(0, n); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not sure. My guess is it was done this way as a micro-optimization for the common case. Seems like just calling s.slice(0,n) as you suggest would be better.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string. PR-URL: nodejs#8132 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Alexander Makarenko <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
|
Landed in 2e59cce |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string. PR-URL: #8132 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Alexander Makarenko <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
The internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string. PR-URL: #8132 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Alexander Makarenko <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
The internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string. PR-URL: #8132 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Alexander Makarenko <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
The internal function `truncate()` is only called with the first argument being the output of `util.inspect()`. `util.inspect()` calls its own internal `formatValue()` which is guaranteed to return a string. Therefore, we can remove the check in `truncate()` that the first argument is a string as well as code to handle the case where it is not a string. PR-URL: #8132 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Alexander Makarenko <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.