For a project, I am running a NodeJS app using Express. I wanted to organize my code and put some objects in a module I am calling with a require.
Something like
var xlsImport = require(path.join(__dirname, '../config/xlsImport.js'))(mongoose, mongooseAppUsers, mongooseNodeJS_Test);
My module looks like :
module.exports = function (mongoose,mongooseAppUsers,mongooseNodeJS_Test) {
var module={};
(...)
module.convertField = {
(...)
"Jeu": "game",
"Démo": "demo",
(...)
return module;
};
In the main file,
xlsImport.convertField['Jeu'] is "game"
xlsImport.convertField['Démo'] is undefined
In the module, both are OK !
I suspect a copy mechanism to be involved...
Any suggestion for solving that problem ? (and some hints about the why ?)