So, I create a database layer and perform standard CRUD operations (Create, Read, Update, Delete) as functions. I am working on how to export each function.
Method 1
function func1 () {}
function func2 () {}
module.exports = {
"func1": func1,
"func2": func2
}
Method 2
var exporting;
exporting.func1 = function() {};
exporting.func2 = function() {};
module.exports = exporting;
or, just do it directly:
module.exports.func1 = function() {};
module.exports.func2 = function() {};
Method 3
export func1 = function() {}
export func2 = function() {}
I am sure that this will not harm any method, but what are the pros and cons (if any) of each of them?
source
share