Currently, I have 4 Child Classes each in their own file. I'm requiring them all in the same file. I am wondering if I can contain all 4 of those classes in a single module. Currently, I'm importing them like this
var Jack = require('./Jack.js');
var JackInstance = new Jack();
var Jones = require('./Jones.js');
var JonesInstance = new Jones();
I'd like to import them like this
var People = require('./People.js');
var JackInstance = new People.Jack();
Or even
var Jack = require('./People.js').Jack;
var JackInstance = new Jack();
My classes are defined like so
class Jack{
//Memeber variables, functions, etc
}
module.exports = Jack;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…