Repository navigation
Conversation
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.
Member
Author
Member
Author
|
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. |
Member
|
LGTM |
| } else { | ||
| return s; | ||
| } | ||
| return s.length < n ? s : s.slice(0, n); |
Member
Author
There was a problem hiding this comment.
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.
commented
Aug 17, 2016
Contributor
|
LGTM |
commented
Aug 17, 2016
Member
Author
commented
Aug 17, 2016
Member
|
LGTM |
1 similar comment
commented
Aug 17, 2016
Contributor
|
LGTM |
commented
Aug 18, 2016
Member
Author
|
Landed in 2e59cce |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
assert
Description of change
The internal function
truncate()is only called with the firstargument being the output of
util.inspect().util.inspect()callsits own internal
formatValue()which is guaranteed to return a string.Therefore, we can remove the check in
truncate()that the firstargument is a string as well as code to handle the case where it is not
a string.