I have simple module query.js:
module.exports = function(queryString){
return{
string: queryString
};
};
Now I am loading this module from another module and create instance out of it:
var Query = require("./query");
var myQuery = new Query("SELECT * FROM `mytabel`");
console.log(myQuery instanceof Query); // Ouputs false
console.log(myQuery.constructor == Query); // Outputs false
As I understood from the nodejs documentation, require("Query") gives me module.exports object which in my case is anonymous function that accepts 1 parameter queryString. I use this function to create new object myQuery and yet, it is not instance of Query.
MY QUESTION: How can I check if myQuery is created from the Query function and why are both outputs false when they should be true in my opinion?