December 15th, 2015
In Technology
No Comments
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
If you enjoy this article, see the other most popular articles
Require and Export in NodeJs
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com, or follow me on Twitter.
Finally, the last thing to consider is what happens when you directly export a function:
var powerLevel = function(level) {
return level > 9000 ? “it’s over 9000!!!” : level;
};
module.exports = powerLevel;When you require the above file, the returned value is the actual function. This means that you can do:
require(‘./powerlevel’)(9050);
Which is really just a condensed version of:
var powerLevel = require(‘./powerlevel’)
powerLevel(9050);
Post external references
- 1
http://openmymind.net/2012/2/3/Node-Require-and-Exports/
February 8, 2022 9:33 am
From Michael S on How I recovered from Lyme Disease: I fasted for two weeks, no food, just water
"Did you have Bartonella, too? Seems it uses autogenesis..."