I have a class that contains few functions, putting one of then below,
const _ = require("lodash");
const ObjectId = require("mongoose").Types.ObjectId;
const mockLookUps = require(“../../data”).mockLookUps;
class XYZ {
// ...... Other functions
async getData() {
return Promise.resolve(mockLookUps); // JSON Object
}
}
module.exports = XYZ;
if I import that in other class like below,
const x = await XYZ.getData();
It is throwing me some is not a function error like this,
XYZ.getData is not a function
What is the mistake I'm making?
Promise.resolvesince your method isasyncanyway.