-
Notifications
You must be signed in to change notification settings - Fork 231
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
Import Node 10.9.0. Redo the fix for util.inspect.custom #357
Conversation
Is this still needed? readable-stream/test/browser.js Lines 16 to 20 in 2149b0d
|
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 but the fallback for custom inspection should be 'inspect'
.
lib/internal/streams/buffer_list.js
Outdated
var _require2 = require('util'), | ||
inspect = _require2.inspect; | ||
|
||
var custom = inspect && custom || Symbol('useless'); |
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.
Instead of using Symbol('useless')
fall back to 'inspect'
. That way old Node versions should work properly.
const Buffer = require('buffer').Buffer | ||
const util = require('util') | ||
const { inspect } = require('util') | ||
const custom = inspect && inspect.custom || '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.
Won't this browserify all of util
? I wrote https://github.com/mafintosh/inspect-custom-symbol to get around that (util is pretty big!)
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.
@mafintosh that module uses the symbol instead of 'inspect'
as a key. See https://github.com/mafintosh/inspect-custom-symbol/blob/master/index.js#L4. @BridgeAR should we use the symbol or the property here?
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.
Also see #356 to remove the use of util.
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.
It should be 'inspect'
. Otherwise old Node.js versions won't work and a symbol has no other effect on browserify in this case than the string.
I don't use browserify often enough to know exactly what it would pull in but it should only be the parts that are used and in this case it is only the inspection property. So that should be fine.
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.
I think we should land this as is and deal with removing util in #356. What do you think? May I get a couple of LGTM?
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.
Added a comment |
Fixes #355