-
Notifications
You must be signed in to change notification settings - Fork 30k
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
doc: 'constructor' implies use of new keyword #17364
Conversation
the square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also turn square
into Square
in this case? It’s a bit more common to start constructor names with a capital letter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once @addaleax's comment is addressed
Very good point. Updated. |
No objection, but a simpler fix might be to leave the code as is and simply remove the words |
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Landed in 1449c18 Thanks for the contribution @CameronMoorehead! Congrats on becoming a Contributor!! 🎉 |
Shouldn’t the example |
@charmander Yes. 👍PR coming up... this is what happens when no one clicks to see the rest of the code 😆 |
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
The square module is described as exporting a constructor, which would mean it would need to be invoked with the new keyword in bar.js after requiring it. Otherwise it's technically a factory function, not a constructor. PR-URL: #17364 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com>
the square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc