0

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);
Oxi
  • 2,918
  • 17
  • 28
max
  • 318
  • 1
  • 11
  • Presumably the filename isn't going to change either, no...!? – deceze Jan 13 '16 at 09:48
  • The file won't change. But it will get copied and build upon on from others, who are barely familiar with it. It would be practical to avoid problems. – max Jan 13 '16 at 09:53

0 Answers0