-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
[v12.x] multiple util and assert backports #31431
Commits on Jan 20, 2020
-
util: fix .format() not always calling toString when it should be
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: nodejs#30343 Fixes: nodejs#30333 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Configuration menu - View commit details
-
Copy full SHA for 9d82b76 - Browse repository at this point
Copy the full SHA 9d82b76View commit details -
benchmark: add more util inspect and format benchmarks
This adds a couple of benchmarks to check different options and code paths. PR-URL: nodejs#30767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 2859667 - Browse repository at this point
Copy the full SHA 2859667View commit details -
util: improve performance inspecting proxies
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: nodejs#30767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for e110449 - Browse repository at this point
Copy the full SHA e110449View commit details -
util: never trigger any proxy traps using
format()
PR-URL: nodejs#30767 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 62ed6a2 - Browse repository at this point
Copy the full SHA 62ed6a2View commit details -
This makes sure that the regular expression matches all built-in objects properly. So far a couple where missed. PR-URL: nodejs#30768 Fixes: nodejs#30183 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Configuration menu - View commit details
-
Copy full SHA for 7d19aba - Browse repository at this point
Copy the full SHA 7d19abaView commit details -
util: inspect (user defined) prototype properties
This is only active if the `showHidden` option is truthy. The implementation is a trade-off between accuracy and performance. This will miss properties such as properties added to built-in data types. The goal is mainly to visualize prototype getters and setters such as: class Foo { ownProperty = true get bar() { return 'Hello world!' } } const a = new Foo() The `bar` property is a non-enumerable property on the prototype while `ownProperty` will be set directly on the created instance. The output is similar to the one of Chromium when inspecting objects closer. The output from Firefox is difficult to compare, since it's always a structured interactive output and was therefore not taken into account. PR-URL: nodejs#30768 Fixes: nodejs#30183 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Configuration menu - View commit details
-
Copy full SHA for a9d41b7 - Browse repository at this point
Copy the full SHA a9d41b7View commit details
Commits on Jan 22, 2020
-
util: refactor inspect code for constistency
This removes the special handling to inspect iterable objects with a null prototype. It is now handled together with the regular prototype. PR-URL: nodejs#30225 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 0b08d32 - Browse repository at this point
Copy the full SHA 0b08d32View commit details -
util: add (typed) array length to the default output
Align the inspect output with the one used in the Chrome dev tools. A recent survey outlined that most users prefer to see the number of set and map entries. This should count as well for array sizes. The size is only added to regular arrays in case the constructor is not the default constructor. Typed arrays always indicate their size. PR-URL: nodejs#31027 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 1e2c535 - Browse repository at this point
Copy the full SHA 1e2c535View commit details -
src: accept single argument in getProxyDetails
This makes sure this function stays backwards compatible in case it's accessed through the binding directly. Refs: nodejs#29947 (comment) PR-URL: nodejs#30858 Refs: nodejs#30767 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Configuration menu - View commit details
-
Copy full SHA for a676531 - Browse repository at this point
Copy the full SHA a676531View commit details -
util: improve prototype inspection using
inspect()
andshowHidden
The fast path for the prototype inspection had a bug that caused some prototype properties to be skipped that should in fact be inspected. PR-URL: nodejs#31113 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 9c9b338 - Browse repository at this point
Copy the full SHA 9c9b338View commit details -
assert: fix generatedMessage property
This makes sure the `generatedMessage` property is always set as expected. This was not the case some `assert.throws` and `assert.rejects` calls. PR-URL: nodejs#28263 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 32dfdb8 - Browse repository at this point
Copy the full SHA 32dfdb8View commit details -
This refactors some code for less duplication. PR-URL: nodejs#28263 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ad12514 - Browse repository at this point
Copy the full SHA ad12514View commit details -
doc: update assert.throws() examples
This updates two outdated examples to the current implementation. PR-URL: nodejs#28263 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 8b82c85 - Browse repository at this point
Copy the full SHA 8b82c85View commit details -
doc: make
AssertionError
a linkThis makes sure that `AssertionError` links to the correct place in the assert documentation. PR-URL: nodejs#28263 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for ed2d864 - Browse repository at this point
Copy the full SHA ed2d864View commit details -
assert: implement
assert.match()
andassert.doesNotMatch()
This adds a new functionality to the assertion module: a dedicated check for regular expressions. So far it's possible to use `assert.ok(regexp.test(string))`. This is not ideal though when it comes to the error message, since it's not possible to know how either of the input values look like. It's just known that the assertion failed. This allows to pass through the regular expression and the input string. The string is then matched against the regular expression and reports a expressive error message in case of a failure. PR-URL: nodejs#30929 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Configuration menu - View commit details
-
Copy full SHA for e2970ab - Browse repository at this point
Copy the full SHA e2970abView commit details