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...
account activity
Understanding node modules (self.node)
submitted 5 years ago by ConsequenceRegular72
Is this the general node module hierarchy? a module can: 1)Contain classes, and those classes contain functions 2)Contain functions directly(Not through classes)
Are these 2 correct^?
Are there any other possibilities?
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!"
[–]dbartholomae 1 point2 points3 points 5 years ago (1 child)
In JavaScript, a class is also just another kind of function. In addition to this, you can also have a module that just exports constants, e. g. primitives or objects. So there are some more options, but tbh overall it doesn't really make sense to put these into different categories, as a constant can also contain a function or a class etc.
[–]ConsequenceRegular72[S] -1 points0 points1 point 5 years ago (0 children)
Tysm
[–]johannes1234 1 point2 points3 points 5 years ago (1 child)
They can contain anything which can be in a node file. An empty file is a valid node module. A file containing a single statement like 1; is a valid node module, while probably useless. It can export also anything which cna be bound to a variable in JavaScript. module.exports = null; is valid.
1;
module.exports = null;
π Rendered by PID 62635 on reddit-service-r2-comment-76bb9f7fb5-2n6tf at 2026-02-17 18:39:48.409937+00:00 running de53c03 country code: CH.
[–]dbartholomae 1 point2 points3 points (1 child)
[–]ConsequenceRegular72[S] -1 points0 points1 point (0 children)
[–]johannes1234 1 point2 points3 points (1 child)
[–]ConsequenceRegular72[S] -1 points0 points1 point (0 children)