Skip to content
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

[WIP] Sync features with Node 9 #24

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

[WIP] Sync features with Node 9 #24

wants to merge 7 commits into from

Conversation

goto-bus-stop
Copy link
Member

@goto-bus-stop goto-bus-stop commented Mar 7, 2018

Still need to port:

  • callbackify
  • format
  • inspect
  • isDeepStrictEqual

@goto-bus-stop
Copy link
Member Author

The new inspect() function is significantly bigger which is unfortunate. Hopefully common-shakeify can usually remove it from browser builds.

@goto-bus-stop
Copy link
Member Author

goto-bus-stop commented Mar 7, 2018

Think I'll split this up so we can get promisify out the door first :P not that many people really need the new format features, probably!

@eemeli
Copy link

eemeli commented Feb 1, 2019

How could I help get at least the util.inspect part of this available on npm? I'd like to use it in eemeli/yaml-playground. Brief testing would suggest that it mostly works, except for indentation depth with Map and Set objects.

@BridgeAR
Copy link
Member

BridgeAR commented May 6, 2019

What's the status here?

@BridgeAR
Copy link
Member

Ping @goto-bus-stop

@goto-bus-stop
Copy link
Member Author

promisify/callbackify was landed separately, debuglog is in another PR. Maybe we can extract the inspect progress from this as a separate PR too, but it may be tricky to reconcile the current master with this PR and with the latest Node.js implementation. No work happened here since the last visible changes.

I can't commit enough time to finish inspect in the near future

@@ -113,6 +208,7 @@ exports.debuglog = function(set) {
return debugs[set];
};

var customInspectSymbol = typeof Symbol !== 'undefined' ? Symbol('util.inspect.custom') : undefined;
Copy link

Choose a reason for hiding this comment

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

Node 10.12 and newer registers the util.inspect.custom symbol as nodejs.util.inspect.custom, making it possible to use Symbol.for('nodejs.util.inspect.custom') to get the equivalent util.inspect.custom symbol without depending on util:

Suggested change
var customInspectSymbol = typeof Symbol !== 'undefined' ? Symbol('util.inspect.custom') : undefined;
var customInspectSymbol = typeof Symbol !== 'undefined' && typeof Symbol.for !== 'undefined' ? Symbol.for('nodejs.util.inspect.custom') : undefined;

Copy link
Member

Choose a reason for hiding this comment

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

Browsers, however, don’t register it, so I’d you don’t have util.inspect, there’s no point in having the symbol - why not just depend on util?

Copy link
Member

@ljharb ljharb Feb 2, 2020

Choose a reason for hiding this comment

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

Also, node 6.6-10.11 all require this code, and can’t rely on the shared symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants