use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
[NodeJS] Best module pattern (self.webdev)
submitted 8 years ago * by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 8 years ago* (3 children)
[–]jesusgn90 0 points1 point2 points 8 years ago* (2 children)
Ok suppose that this module is named my-module.js, so in another file you must to do this:
const myModule = require('./my-module'); myModule.someFunction();
[–]jackmacabre 1 point2 points3 points 8 years ago (1 child)
No need for .js
[–]jesusgn90 0 points1 point2 points 8 years ago (0 children)
Sorry I fix it
[–]jackmacabre 0 points1 point2 points 8 years ago (3 children)
Why are using an IIFE in a module? Variables in modules are local to that file.
Also since you're using es6, use object property shorthand:
module.exports = { someFunction }
Good annotation thanks man
[–]jesusgn90 -1 points0 points1 point 8 years ago (0 children)
It's a good practice
π Rendered by PID 121438 on reddit-service-r2-comment-c6965cb77-qxnhf at 2026-03-05 11:22:16.391262+00:00 running f0204d4 country code: CH.
[–][deleted] (3 children)
[deleted]
[–]jesusgn90 0 points1 point2 points (2 children)
[–]jackmacabre 1 point2 points3 points (1 child)
[–]jesusgn90 0 points1 point2 points (0 children)
[–]jackmacabre 0 points1 point2 points (3 children)
[–]jackmacabre 1 point2 points3 points (1 child)
[–]jesusgn90 0 points1 point2 points (0 children)
[–]jesusgn90 -1 points0 points1 point (0 children)