0

I am trying to export common methods in a common js file. but it was exported only to the last method. how to fix it?

common.js

module.export = getMethodOne = async ()=>{}
module.export = getMethodTwo= async ()=>{}

main.js

var getMethodOne = require("./common.js");
var getMethodTwo = require("./common.js");

I will try this way. but it was not working.

module.export = {
  getMethodOne = async ()=>{}
  getMethodTwo= async ()=>{}
}

how to fix it?

1 Answers1

0

Common.js

getMethodOne = async ()=>{};
getMethodTwo= async ()=>{};
module.exports = { getMethodOne, getMethodTwo };

Main.js

const { getMethodOne, getMethodTwo } = require('./common');
Yatin Gupta
  • 653
  • 5
  • 12