Conversation
lib/repl.js
Outdated
| } | ||
| } catch (e) { | ||
| //console.log("completion error walking prototype chain:" + e); | ||
| // console.log("completion error walking prototype chain:" + e); |
| } | ||
| // We're given a duplex readable/writable Stream, like a `net.Socket` | ||
| // or a custom object with 2 streams, or the `process` object | ||
| input = stream.stdin || stream; |
There was a problem hiding this comment.
It probably doesn't make a difference, but this has the potential to be a behavior change if only one of stream.stdin or stream.stdout were passed in.
There was a problem hiding this comment.
Hm, do you want me to change it to the way it was before? I personally do not feel like this is ever going to matter.
lib/repl.js
Outdated
| memberGroups[i].map((member) => expr + '.' + member)); | ||
| } | ||
| if (filter) { | ||
| filter = expr + '.' + filter; |
There was a problem hiding this comment.
filter = expr + '.' + filter;This can be changed to
filter = `${ expr }.${ filter }`;Since it removes access usage of +
lib/repl.js
Outdated
| return expr + '.' + member; | ||
| })); | ||
| completionGroups.push( | ||
| memberGroups[i].map((member) => expr + '.' + member)); |
There was a problem hiding this comment.
const foo = memberGroups.reduce(( acc, memberGroup ) => {
acc.push(memberGroup.map((member) => `${ expr }.${ member }`));
return acc;
}, []);
completionGroups.concat(foo);Don't mind the name foo as could not think of some descent name but this will make the code immutable. Although we are mutating completionGroups array but in next change we can convert it also to immutability
There was a problem hiding this comment.
That is not necessary out of my perspective. I personally feel the current code is more expressive than using reduce.
PR-URL: nodejs#17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
PR-URL: nodejs#17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
|
this does not land cleanly on v9.x, could you please backport? as an aside @BridgeAR it appears you are listing the commits in the reverse order they landed... which can make things confusing when landing on release branches. In future could you post the commits in chronological order, or alternatively using the range syntax [headbefore]...[headafter] |
|
Backported in #19244 (about the order: I fixed that a while ago in my script. It is always in chronological order again). |
PR-URL: nodejs#17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
PR-URL: nodejs#17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
Backport-PR-URL: #19244 PR-URL: #17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
Backport-PR-URL: #19244 PR-URL: #17919 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Lance Ball <lball@redhat.com>
|
Backport requested for 8.x in #19244 |
Just a minor refactoring to make the code more pleasant.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
repl