-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
More realistic custom inspect example #8875
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -301,7 +301,7 @@ class Box { | |
| }); | ||
|
|
||
| // Five space padding because that's the size of "Box< ". | ||
| const padding = ' '; | ||
| const padding = ' '.repeat(5); | ||
| const inner = util.inspect(this.value, newOptions).replace(/\n/g, '\n' + padding); | ||
| return options.stylize('Box', 'special') + '< ' + inner + ' >'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know I already signed off on this but, just as a very minor nit, this could be slightly simplified to: return `${options.stylize('Box', 'special')}<${inner}>`;
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure I’d find that more readable… long expressions inside So, maybe
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really want to mix quasiquoting and string concatenation together? Seems like any option we go with (other than just string concatenation IMO) looks weird. |
||
| } | ||
|
|
||
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.
And a comment here about what this call to
util.inspectis for.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.
Will do when I have time and energy.