Yann Hamon
c957b05177
http: send connection: close when closing conn
...
HTTP/1.1 mandates connections which do not support keep-alive and
close the connection send the connection: close header, see
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.10
This page also provides more information:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
I understand that HTTP/1.1 defaults to keep-alive - and that the
Connection: close header is required when closing a connection.
This adds the Connection: close header in the 400 and 414
responses sent on client errors.
PR-URL: https://github.com/nodejs/node/pull/26467
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-09 00:23:48 +01:00
gengjiawen
4fb88cd888
http: improve for-loop readability in _http_outgoing.js
...
PR-URL: https://github.com/nodejs/node/pull/26408
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-09 00:12:52 +01:00
Gus Caplan
9f1282d536
lib: move queueMicrotask to stable
...
PR-URL: https://github.com/nodejs/node/pull/25594
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Yuta Hiroto <hello@hiroppy.me >
2019-03-08 08:19:38 -06:00
Joyee Cheung
b05fd4baa8
lib: explicitly initialize debuglog during bootstrap
...
This patch splits the implementation of util.debuglog into a
separate file and explicitly initialize it during pre-execution
since the initialization depends on environment variables.
Also delays the call to `debuglog` in modules that are loaded during
bootstrap to make sure we only access the environment variable
during pre-execution.
PR-URL: https://github.com/nodejs/node/pull/26468
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:57:38 +01:00
Joyee Cheung
687f30467b
process: call prepareMainThreadExecution in all main thread scripts
...
PR-URL: https://github.com/nodejs/node/pull/26468
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:57:36 +01:00
Joyee Cheung
21440c8acd
lib: move format and formatWithOptions into internal/util/inspect.js
...
So these can be required without requiring the whole `util.js`.
PR-URL: https://github.com/nodejs/node/pull/26468
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:57:34 +01:00
Joyee Cheung
f617a732f8
process: handle process.env.NODE_V8_COVERAGE in pre-execution
...
Since this depends on environment variable, and the worker threads
do not need to persist the variable value because they cannot
switch cwd.
PR-URL: https://github.com/nodejs/node/pull/26466
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:53:52 +01:00
Joyee Cheung
d7543a79d6
process: set up process warning handler in pre-execution
...
Since it depends on environment variables.
PR-URL: https://github.com/nodejs/node/pull/26466
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:53:50 +01:00
Joyee Cheung
f9b76c3bf4
process: call prepareMainThreadExecution in node inspect
...
Since we should treat the node-inspect as third-party
user code.
PR-URL: https://github.com/nodejs/node/pull/26466
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-08 13:53:48 +01:00
Ruben Bridgewater
82f8821401
repl: add replDefaults to customize the writer
...
So far it was not possible to modify the inspection defaults used by
the REPL from the running instance itself. This introduces a new
property on `util.inspect` which is only used inside the REPL and which
allows to modify the used inspection defaults at any point of time.
PR-URL: https://github.com/nodejs/node/pull/26375
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-08 04:44:56 +01:00
kohta ito
1133e0bf8b
child_process: fire close event from stdio
...
PR-URL: https://github.com/nodejs/node/pull/22892
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-03-07 17:38:39 +01:00
Anna Henningsen
76e67e9884
lib: assign missed deprecation code
...
Refs: https://github.com/nodejs/node/pull/26245
PR-URL: https://github.com/nodejs/node/pull/26492
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-03-07 15:48:55 +01:00
gengjiawen
0fa11654c7
http: remove unused variable in _http_server.js
...
PR-URL: https://github.com/nodejs/node/pull/26407
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-07 06:18:43 +01:00
Joyee Cheung
03c71a95e2
src: use the config binding to carry --no-browser-globals
...
Instead of setting it in the process object, since this is
a configure-time option. Also added a shim that can be
deprecated and removed some time later.
PR-URL: https://github.com/nodejs/node/pull/26228
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-07 00:27:40 +01:00
Patrick Gansterer
4895927a0a
crypto: add KeyObject.asymmetricKeySize
...
Expose the size of asymetric keys of crypto key object from the
crypto module added in v11.6.0.
PR-URL: https://github.com/nodejs/node/pull/26387
Refs: https://github.com/nodejs/node/pull/24234
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-07 00:24:07 +01:00
Matteo Collina
3c83f93437
http: check for existance in resetHeadersTimeoutOnReqEnd
...
socket.parser can be undefined under unknown circumstances.
This is a fix for a bug I cannot reproduce but it is affecting
people.
Fixes: https://github.com/nodejs/node/issues/26366
PR-URL: https://github.com/nodejs/node/pull/26402
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-03-06 14:32:39 +00:00
Matteo Collina
e95e7f9af5
stream: make sure 'readable' is emitted before ending the stream
...
Fixes: https://github.com/nodejs/node/issues/25810
PR-URL: https://github.com/nodejs/node/pull/26059
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-06 08:38:29 +00:00
Luigi Pinca
49f1bb9b93
stream: ensure writable.destroy() emits error once
...
Prevent the `'error'` event from being emitted multiple times if
`writable.destroy()` is called with an error before the `_destroy()`
callback is called.
Emit the first error, discard all others.
PR-URL: https://github.com/nodejs/node/pull/26057
Fixes: https://github.com/nodejs/node/issues/26015
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-05 23:52:36 +01:00
Anna Henningsen
69906fbc52
benchmark,lib: add process.hrtime.bigint benchmark
...
Add a benchmark, and amend the relevant source code comment to state
that currently, switching to directly returning a BigInt is not
stopped by technical obstacles but rather the fact that using a typed
array is actually a bit faster (about 2.5 %, measured locally).
PR-URL: https://github.com/nodejs/node/pull/26381
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-05 23:23:53 +01:00
cjihrig
cc4e8e0696
report: warn on process.report object access
...
Reduce the number of emitExperimentalWarning() call sites by
making process.report emit a warning on access instead of each
individual report function.
PR-URL: https://github.com/nodejs/node/pull/26414
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Wyatt Preul <wpreul@gmail.com >
2019-03-05 15:36:06 -05:00
cjihrig
30ee27784c
report: refactor configuration management
...
This commit removes process.report.setOptions(). Instead of
using complex configuration synchronization between C++ and
JS, this commit introduces individual getters and setters.
PR-URL: https://github.com/nodejs/node/pull/26414
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Wyatt Preul <wpreul@gmail.com >
2019-03-05 15:35:58 -05:00
Ruben Bridgewater
d4fdec6b65
tty: add hasColors function
...
This adds a small wrapper around the `getColorDepth` function to check
if the stream supports at least a specific amount of colors. This is
convenient as the other API is not as straight forward and most use
cases likely only want to know if a specific amount of colors is
supported or not.
PR-URL: https://github.com/nodejs/node/pull/26247
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Weijia Wang <starkwang@126.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com >
2019-03-05 18:37:39 +01:00
Tobias Nießen
fe7162915e
crypto: allow deriving public from private keys
...
This change allows passing private key objects to
crypto.createPublicKey, resulting in a key object that represents a
valid public key for the given private key. The returned public key
object can be used and exported safely without revealing information
about the private key.
PR-URL: https://github.com/nodejs/node/pull/26278
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2019-03-05 16:32:19 +01:00
gengjiawen
e630569883
cluster: improve for-loop
...
PR-URL: https://github.com/nodejs/node/pull/26336
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-05 02:06:46 +01:00
gengjiawen
d79176a3c3
events: improve for-loop
...
PR-URL: https://github.com/nodejs/node/pull/26354
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com >
2019-03-05 02:04:32 +01:00
leeight
c8e0c09086
https: add missing localPort while create socket
...
In `_tls_wrap.js` while calling `socket.connect` the `localPort` was
missing, restore it.
PR-URL: https://github.com/nodejs/node/pull/24554
Fixes: https://github.com/nodejs/node/issues/24543
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-05 01:52:17 +01:00
himself65
acc506c2d2
events: onceWrapper returns target value
...
PR-URL: https://github.com/nodejs/node/pull/25818
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2019-03-05 01:50:24 +01:00
gengjiawen
905988ae68
http2: refactor deprecated method in core.js
...
PR-URL: https://github.com/nodejs/node/pull/26275
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-05 01:47:45 +01:00
Sam Roberts
c7e628f8b3
lib: deprecate _stream_wrap
...
Its unused by node, and doesn't have a reasonable use outside of node.
See: https://github.com/nodejs/node/pull/25153
See: https://github.com/nodejs/node/pull/16158
PR-URL: https://github.com/nodejs/node/pull/26245
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2019-03-04 10:27:50 -08:00
Guy Bedford
b2abda9ba0
bootstrap: experimental --frozen-intrinsics flag
...
PR-URL: https://github.com/nodejs/node/pull/25685
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2019-03-04 16:34:33 +02:00
Sagi Tsofan
8c597df350
http2: improve compatibility with http/1
...
When using the compatibility API the connection header is from now on
ignored instead of throwing an `ERR_HTTP2_INVALID_CONNECTION_HEADERS`
error.
This logs a warning in such case to notify the user about the ignored
header.
PR-URL: https://github.com/nodejs/node/pull/23908
Fixes: https://github.com/nodejs/node/issues/23748
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-04 02:59:26 +01:00
cjihrig
b271b0315a
report: use triggerReport() to handle signals
...
This commit uses the triggerReport() binding to handle
signals and removes the custom onUserSignal() function.
PR-URL: https://github.com/nodejs/node/pull/26386
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-03 19:26:04 -05:00
cjihrig
48ab54c323
report: use triggerReport() to handle exceptions
...
This commit uses the triggerReport() binding to handle
uncaught exceptions and removes the custom onUncaughtException
function.
PR-URL: https://github.com/nodejs/node/pull/26386
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-03 19:25:46 -05:00
Anna Henningsen
28db96f31c
zlib: report premature ends earlier
...
Report end-of-stream when decompressing when we detect it,
and do not wait until the writable side of a zlib stream
is closed as well.
Refs: https://github.com/nodejs/node/issues/26332
PR-URL: https://github.com/nodejs/node/pull/26363
Refs: https://github.com/nodejs/node/issues/26332
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-04 00:13:40 +01:00
Anna Henningsen
a0778a97e1
repl: use object writer for thrown errors
...
This makes us use the defaults that were set for the REPL, i.e.
aligns with the printing of expression completion values, and in
particular enables color support.
PR-URL: https://github.com/nodejs/node/pull/26361
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-04 00:12:07 +01:00
Ruben Bridgewater
f871c80a6d
tty: improve color detection
...
1) Using `process.env.TERM = 'dumb'` should never return any colors.
2) `process.env.TERM = 'terminator'` supports 24 bit colors.
3) Add support for `process.env.TERM = 'rxvt-unicode-24bit'`
4) `Hyper` does not support true colors anymore. It should fall back
to the xterm settings in regular cases.
5) `process.env.COLORTERM = 'truecolor'` should return 24 bit colors.
PR-URL: https://github.com/nodejs/node/pull/26264
Refs: https://github.com/nodejs/node/pull/26261
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-03 23:31:44 +01:00
Guy Bedford
ccaebdef66
esm: process proxy Symbol.toString fix
...
PR-URL: https://github.com/nodejs/node/pull/25963
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-03 18:20:45 +02:00
cjihrig
f9cd5e3094
doc,lib,test: rename node-report to report
...
This commit completes the renaming of node-report to report
in order to better differentiate core's reporting from the
node-report npm module.
PR-URL: https://github.com/nodejs/node/pull/26371
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Minwoo Jung <minwoo@nodesource.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-02 21:17:33 -05:00
Matteo Collina and David Mark Clements
b1ef279d57
events: add once method to use promises with EventEmitter
...
This change adds a EventEmitter.once() method that wraps ee.once in a
promise.
Co-authored-by: David Mark Clements <david.mark.clements@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/26078
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
2019-03-02 19:17:45 +01:00
Tobias Nießen
b8018f407b
crypto: move DEP0113 to End-of-Life
...
PR-URL: https://github.com/nodejs/node/pull/26249
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2019-03-02 10:58:12 +01:00
Thomas
e9ed6b988f
console: prevent constructing console methods
...
Ref: https://github.com/nodejs/node/issues/25987
PR-URL: https://github.com/nodejs/node/pull/26096
Refs: https://github.com/nodejs/node/issues/25987
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com >
2019-03-02 00:07:53 +01:00
Anna Henningsen
6a0f4636d9
buffer: avoid materializing ArrayBuffer for creation
...
Do not create an `ArrayBuffer` if the engine’s settings avoid it
and we don’t need it.
PR-URL: https://github.com/nodejs/node/pull/26301
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2019-03-01 21:58:06 +01:00
cjihrig
4afd503465
doc,test,repl: fix deprecation code
...
PR-URL: https://github.com/nodejs/node/pull/26368
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2019-03-01 13:11:02 -05:00
Avi ד
fedc31bb3c
readline: improve Unicode handling
...
Prevents moving left or right from placing the cursor in between code
units comprising a code point.
PR-URL: https://github.com/nodejs/node/pull/25723
Fixes: https://github.com/nodejs/node/issues/25693
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2019-03-01 15:59:58 +01:00
Ruben Bridgewater
0fd5b458be
path: refactor code for clarity
...
This moves a condition inside of a for loop which can only be
triggered at the very end of the for loop outside of the loop. That
way the for loop itself is much simpler and easier to understand and
the code itself is less indented which should increase the
readability.
It also refactors some `var` to `let` and `const`.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:33 +01:00
Ruben Bridgewater
7cbe29eb4d
path: refactor for less indentation
...
This moves the `if (len === 1)` case to the top of the function.
That way it is possible to reduce the indentation level due to
returning early in that case.
On top of that the following was done:
1) For clarity refactored for loops which were meant to count up a
variable into a while loop.
2) Used template strings instead of string concat.
3) Consolidating nested if statements.
4) Using tenary expressions if applicable when assigning variables
to reduce the code overhead.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:30 +01:00
Ruben Bridgewater
e68b0d6fb3
path: simplify code and remove obsolete checks
...
Either `end` is `-1` or `startPart` is not `0`. Therefore it's
possible to move the conditions in a way that we eliminate a few code
branches.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:26 +01:00
Ruben Bridgewater
e750e9583e
path: refactor logic for to reduce code branches
...
This refactoring makes sure some code branches will not be hit if
they do not have to be reached.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:22 +01:00
Ruben Bridgewater
f59fdd9d65
path: minor refactoring
...
1) Consolidate nested if statements if possible
`if (foo) { if bar () { /* do stuff */ } }`)
to reduce indentation depth.
2) Remove obsolete else cases to reduce indentation.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:19 +01:00
Ruben Bridgewater
a019d7bd0b
path: refactor more path code for simplicity
...
1) Consolidate format to a single function.
2) Move some code that can only be reached in some code branches
that was formerly executed in all cases.
3) Explicitly check for the string length of zero instead of
converting the string to a boolean.
4) Consolidate nested if statements if possible e.g.,
if (foo) { if (bar) { /* do stuff */ } }
to reduce indentation depth.
5) Simplify checks by removing extra length checks when comparing
two strings.
6) Use object shorthand notation where possible.
PR-URL: https://github.com/nodejs/node/pull/25278
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2019-03-01 14:55:15 +01:00