I have an File (default.js) which defines an Object like so
return {
parent: {
"default": {
other_properties: true
},
},
another_parent: {
"default": {
other_properties: true
},
}
}
and does nothing else than returning that Object.
But the child object, which has to be named of the current file (eg. "default"
) stays always the same.
I'd like to be able to have the child-object named after the current file. Is that possible on the initial declaration?
Other than that, I already know I can get the filename using
var path = require('path');
var filename = path.basename(__filename);