summaryrefslogtreecommitdiff
path: root/lib/internal/util
AgeCommit message (Collapse)Author
2019-12-08lib: replace Symbol global by the primordials SymbolSebastien Ahkrin
PR-URL: https://github.com/nodejs/node/pull/30737 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-12-07assert: handle (deep) equal(NaN, NaN) as being identicalRuben Bridgewater
This aligns the `equal` and `deepEqual()` implementations with the strict versions by accepting `NaN` as being identical in case both sides are NaN. Refs: https://github.com/nodejs/node/issues/30350#issuecomment-552191641 PR-URL: https://github.com/nodejs/node/pull/30766 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07assert,util: stricter type comparison using deep equal comparisonsRuben Bridgewater
This veryfies that both input arguments are always of the identical type. It was possible to miss a few cases before. This change applies to all deep equal assert functions (e.g., `assert.deepStrictEqual()`) and to `util.isDeepStrictEqual()`. PR-URL: https://github.com/nodejs/node/pull/30764 Refs: https://github.com/nodejs/node/pull/30743 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07util: never trigger any proxy traps using `format()`Ruben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/30767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07util: improve performance inspecting proxiesRuben Bridgewater
This makes sure we do not retrieve the handler in case it's not required. This improves the performance a tiny bit for these cases. PR-URL: https://github.com/nodejs/node/pull/30767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-07util: add more predefined color codes to inspect.colorsRuben Bridgewater
This adds most commonly used ANSI color codes to `util.inspect.colors`. PR-URL: https://github.com/nodejs/node/pull/30659 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-12-07util: improve inspect's customInspect performanceRuben Bridgewater
This improves the performance to copy user options that are then passed through to the custom inspect function. The performance improvement depends on the complexity of the custom inspect function. For very basic cases this is 100% faster than before. PR-URL: https://github.com/nodejs/node/pull/30659 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-11-30lib: enforce use of primordial NumberSebastien Ahkrin
PR-URL: https://github.com/nodejs/node/pull/30700 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-30lib: use static Number properties from primordialsMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/30686 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-11-30util: fix .format() not always calling toString when it should beRuben Bridgewater
This makes sure that `util.format('%s', object)` will always call a user defined `toString` function. It was formerly not the case when the object had the function declared on the super class. At the same time this also makes sure that getters won't be triggered accessing the `constructor` property. PR-URL: https://github.com/nodejs/node/pull/30343 Fixes: https://github.com/nodejs/node/issues/30333 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-11-28util: fix inspection of errors with tampered name or stack propertyRuben Bridgewater
This makes sure that `util.inspect()` does not throw while inspecting errors that have the name or stack property set to a different type than string. Fixes: https://github.com/nodejs/node/issues/30572 PR-URL: https://github.com/nodejs/node/pull/30576 Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-11-27lib: enforce use of Array from primordialsMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/30635 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-11-26util: use let instead of var for util/inspect.jsLuciano
PR-URL: https://github.com/nodejs/node/pull/30399 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-25lib: flatten access to primordialsMichaël Zasso
Store all primordials as properties of the primordials object. Static functions are prefixed by the constructor's name and prototype methods are prefixed by the constructor's name followed by "Prototype". For example: primordials.Object.keys becomes primordials.ObjectKeys. PR-URL: https://github.com/nodejs/node/pull/30610 Refs: https://github.com/nodejs/node/issues/29766 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-19util: escape C1 control characters and switch to hex formatRuben Bridgewater
C1 control characters will from now on also be escaped to prevent altering the terminal behavior. Fixes: https://github.com/nodejs/node/issues/29450 PR-URL: https://github.com/nodejs/node/pull/29826 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-11-17util: replace var with letSusana Ferreira
PR-URL: https://github.com/nodejs/node/pull/30439 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-10-10util: validate formatWithOptions inspectOptionsRuben Bridgewater
This makes sure that the `inspectOptions` are validated. This could otherwise cause confusion. Fixes: https://github.com/nodejs/node/issues/29726 PR-URL: https://github.com/nodejs/node/pull/29824 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-10-05lib: introduce no-mixed-operators eslint rule to libZYSzys
PR-URL: https://github.com/nodejs/node/pull/29834 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-09-23console,util: fix missing recursion end while inspecting prototypesRuben Bridgewater
This makes sure prototypes won't be inspected infinitely for some obscure object creations. The depth is now taken into account and the recursion ends when the depth limit is reached. PR-URL: https://github.com/nodejs/node/pull/29647 Fixes: https://github.com/nodejs/node/issues/29646 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
2019-09-22console: skip/strip %c formattingGus Caplan
Fixes: https://github.com/nodejs/node/issues/29605 Refs: https://console.spec.whatwg.org PR-URL: https://github.com/nodejs/node/pull/29606 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-08-29util: do not throw when inspecting detached ArrayBufferAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/29318 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Gus Caplan <me@gus.host>
2019-08-09util: improve debuglog performanceBrian White
PR-URL: https://github.com/nodejs/node/pull/28956 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-08-09util: isEqualBoxedPrimitive: ensure both values are actual boxed SymbolsJordan Harband
... before trying to valueOf them PR-URL: https://github.com/nodejs/node/pull/29029 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-08-09util: assert: fix deepEqual comparing fake-boxed to real boxed primitiveJordan Harband
PR-URL: https://github.com/nodejs/node/pull/29029 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-06-27process: split routines used to enhance fatal exception stack tracesJoyee Cheung
Previously the enhancement were done right after emitting `'uncaughtException'`, which meant by the time we knew the exception was fatal in C++, the error.stack had already been patched. This patch moves those routines to be called later during the fatal exception handling, and split them into two stages: before and after the inspector is notified by the invocation of `V8Inspector::exceptionThrown`. We now expand the stack to include additional informations about unhandled 'error' events before the inspector is notified, but delay the highlighting of the frames until after the inspector is notified, so that the ANSI escape sequences won't show up in the inspector console. PR-URL: https://github.com/nodejs/node/pull/28308 Fixes: https://github.com/nodejs/node/issues/28287 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-06-27tools: update eslintRuben Bridgewater
This updates eslint from v6.0.0-alpha.2 to v6.0.1 This also removes eslint-disable comments about `bigint` typeof checks. Those would otherwise have caused linting errors now that `bigint` is accepted as valid entry. PR-URL: https://github.com/nodejs/node/pull/28173 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-06-17util: use average bias while grouping arraysRuben Bridgewater
This makes sure that strongly deviating entry length are taken into account while grouping arrays. PR-URL: https://github.com/nodejs/node/pull/28070 Refs: https://github.com/nodejs/node/issues/27690 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-06-17util: improve .inspect() array groupingRuben Bridgewater
This improves a couple minor things: * Arrays that contain entries other than `number` or `bigint` are ordered to the left instead of the right. * The bias towards more columns got increased. That mainly increases the number of columns for arrays that contain lots of short entries. * Columns are now more dense in case they would otherwise have extra whitespace in-between two columns. * The maximum columns got increased from 10 to 15. * The maximum number of columns per `compact` was increased from 3 to 4. PR-URL: https://github.com/nodejs/node/pull/28070 Refs: https://github.com/nodejs/node/issues/27690 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-06-11util: refactor inspecting long linesRuben Bridgewater
Using the `util.inspect` `compact` mode set to something else than `true` resulted in breaking long lines in case the line would exceed the `breakLength` option and if it contained whitespace and or new lines. It turned out that this behavior was less useful than originally expected and it is now changed to only break on line breaks if the `breakLength` option is exceeded for the inspected string. This should be align better with the user expectation than the former behavior. PR-URL: https://github.com/nodejs/node/pull/28055 Fixes: https://github.com/nodejs/node/issues/27690 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-06-09util: special handle `maxArrayLength` while grouping arraysRuben Bridgewater
This makes sure that large arrays with lots of small entries ignore the `... n more item(s)` part since it often resulted in output that users did not expect. Now that part is printed on a separate line to indicate extra entries. PR-URL: https://github.com/nodejs/node/pull/28059 Refs: https://github.com/nodejs/node/issues/27690 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-06-08util: support AsyncGeneratorFunction in .inspectRuben Bridgewater
This makes sure async generator functions are properly detected while using `util.inspect`. PR-URL: https://github.com/nodejs/node/pull/28056 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-26lib: rework logic of stripping BOM+Shebang from commonjsGus Caplan
Fixes https://github.com/nodejs/node/issues/27767 PR-URL: https://github.com/nodejs/node/pull/27768 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-05-26Revert "lib: print to stdout/stderr directly instead of using console"Richard Lau
This reverts commit 2b24ffae2240163a74ae11e49ee198e98abb07dc. Fixes: https://github.com/nodejs/node/issues/27819 PR-URL: https://github.com/nodejs/node/pull/27823 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-20util: include reference anchor for circular structuresRuben Bridgewater
This adds a reference anchor to circular structures when using `util.inspect`. That way it's possible to identify with what object the circular reference corresponds too. PR-URL: https://github.com/nodejs/node/pull/27685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-05-20util: if present, fallback to `toString` using the %s formatterRuben Bridgewater
This makes sure that `util.format` uses `String` to stringify an object in case the object has an own property named `toString` with type `function`. That way objects that do not have such function are still inspected using `util.inspect` and the old behavior is preserved as well. PR-URL: https://github.com/nodejs/node/pull/27621 Refs: https://github.com/facebook/jest/issues/8443 Reviewed-By: Roman Reiss <me@silverwind.io>
2019-05-20util: remove outdated commentRuben Bridgewater
It is probably not necessary to visualize the `code` property as part of the name of an error since all extra properties will be visible anyway due to https://github.com/nodejs/node/pull/272431. PR-URL: https://github.com/nodejs/node/pull/27733 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-05-20util: unify constructor inspection in `util.inspect`Ruben Bridgewater
This makes sure that an objects constructor name is always returned in a similar fashion instead of having different outputs depending on the object shape and the code path taken. PR-URL: https://github.com/nodejs/node/pull/27733 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-05-20util: simplify inspection limit handlingRuben Bridgewater
This simplifies the handling of objects that exceed 128mb. Instead of using a separate property to identify that all following inputs should only return their constructor name it'll just set the depth to -1. That has the almost the same behavior as before while providing a better output in some cases. The performance should be almost identical as well. PR-URL: https://github.com/nodejs/node/pull/27733 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-05-16util: reconstruct constructor in more casesRuben Bridgewater
This makes sure the constructor is reconstructed in cases where we otherwise would not be able to detect the actual constructor anymore. That way some `util.inspect` output is improved. PR-URL: https://github.com/nodejs/node/pull/27668 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-05-13assert: loose deep equal should not compare symbol propertiesRuben Bridgewater
This is the way it's currently documented and that seems appropriate for loose equal assertions. The change was not intentional. Fixes: https://github.com/nodejs/node/issues/27652 PR-URL: https://github.com/nodejs/node/pull/27653 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-05-10tools: enable block-scoped-var eslint ruleRoman Reiss
PR-URL: https://github.com/nodejs/node/pull/27616 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-05-04util: inspect constructor closerRuben Bridgewater
This adds an extra check to `util.inspect` to closer inspect object constructors in case there's not much other information about the constructor. PR-URL: https://github.com/nodejs/node/pull/27522 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-05-02util: better number formattersRuben Bridgewater
This makes sure the `%d`, `%f`, `%i` and `%s` formatters properly visualize `-0`. On top, this also switches to using a safer symbol toString function by using the primordial function. PR-URL: https://github.com/nodejs/node/pull/27499 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-05-02util: improve function inspectionRuben Bridgewater
This commit contains the following changes: 1) Add null prototype support for functions. 2) Safely detect async and generator functions. 3) Mark anonymous functions as such instead of just leaving out the name. PR-URL: https://github.com/nodejs/node/pull/27227 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-04-28lib: print to stdout/stderr directly instead of using consoleJoyee Cheung
This patch adds an internal function that prints to stdout or stderr by directly writing to the known file descriptor, and uses it internally in common cases to avoid the overhead of the console implementation. PR-URL: https://github.com/nodejs/node/pull/27320 Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-26util: add prototype support for boxed primitivesRuben Bridgewater
This makes sure manipulated prototypes from boxed primitives will be highlighted. It also makes sure that a potential `Symbol.toStringTag` is taken into account. PR-URL: https://github.com/nodejs/node/pull/27351 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2019-04-25util: rename setIteratorBraces to getIteratorBracesRuben Bridgewater
The function is actually a getter, not a setter. PR-URL: https://github.com/nodejs/node/pull/27342 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-04-25util: improve `Symbol.toStringTag` handlingRuben Bridgewater
Only special handle `Symbol.toStringTag` if the property is not enumerable or not the own property of the inspected object. PR-URL: https://github.com/nodejs/node/pull/27342 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-04-20util: access process states lazily in debuglogJoyee Cheung
`debuglog()` depends on `process.pid` and `process.env.NODE_DEBUG`, so it needs to be called lazily in top scopes of internal modules that may be loaded before these run time states are allowed to be accessed. This patch makes its implementation lazy by default, the process states are only accessed when the returned debug function is called for the first time. PR-URL: https://github.com/nodejs/node/pull/27281 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-16lib: require globals instead of using the global proxyJoyee Cheung
In addition, use process.stderr instead of console.error when there is no need to swallow the error. PR-URL: https://github.com/nodejs/node/pull/27112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>