In Node.js, each module is in an object format that has the following properties:
Module {
id: '.',
exports: {},
parent: null,
filename: 'C:\Users\Node\first-app\app.js',
loaded: false,
children: [],
paths:
[ 'C:\Users\app\node_modules',
'C:\Users\\Node\node_modules',
'C:\Users\node_modules',
'C:\Users\Documents\node_modules',
'C:\Users\node_modules',
'C:\Users\node_modules',
'C:\node_modules' ] }
But, each module is also in a function format as such:
(function (exports, require, module, __filename, __dirname) {
//content of the function
})
where the function takes exports, require, module, __filename, and __dirname as its parameters. The former is in a key/value format and the latter is in a function definition format. Which one is it?