Conversation
lib/util.js
Outdated
There was a problem hiding this comment.
I think this is harder to reason about, which is why I always add extra parentheses so it's always immediately clear (especially to newcomers).
There was a problem hiding this comment.
It is interesting to see many people preferring this style. I personally always feel like my brain has to compute a tiny bit more when there are extra braces^^. I changed it back though.
58e8c26 to
d2125d5
Compare
|
I found a even better way to optimize for unknown types (e.g. if someone uses a percent as a percent). |
| for (i = 0; i < f.length - 1; i++) { | ||
| if (f.charCodeAt(i) === 37) { // '%' | ||
| const nextChar = f.charCodeAt(++i); | ||
| if (a !== arguments.length) { |
There was a problem hiding this comment.
Would it make sense to store arguments.length in a const given the extensive usage throughout format?
There was a problem hiding this comment.
Actually, that might be worse for perf after reviewing how V8 handles it. You can ignore, I believe.
|
Landed in faaefa8 |
PR-URL: #15422 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: #15422 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: nodejs/node#15422 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: nodejs/node#15422 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
|
should this land in LTS? If so it will need to bake a bit longer. Please change labels as appropriate |
|
@MylesBorins I think we could still backport this to 8.x but I am not sure if it applies without conflicts or not. Would you be so kind and check that? |
|
@BridgeAR this already landed on 8.x, has conflicts on 6.x |
|
Oh, right, I missed that. As 6.x is soon in maintenance only, I do not really think that this has to be backported. I changed the label accordingly. |
|
thanks @BridgeAR in future please add the |
After working on
util.inspectI thought it might be worth also checkingutil.formatas that is called byconsole.log.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
util