Current code:
class Test {
doOne = async () => {
...
};
}
module.exports = new Test();
I want something like this:
class Test {
doOne = async () => {
...
};
}
const testOne = async () => {
...
}
module.exports = new Test();
How can I export testOne function? Is that possible to export both class Test and function testOne?
CodePudding user response:
You need export an object with class and function properties.
class Test {
doOne = async () => {
...
};
}
const testOne = async () => {
...
}
module.exports = {
test: new Test(),
testOne,
}
