I have a file that contains a current function implementation
function bar(){
/*Code goes here*/
}
bar.prototype.method = function(param){
/*Some code*/
return this
}
module.exports = bar
In the test file, I encountered some issues,
let y = require('File path');
y.method(param) /*An error is thrown because it's not defined*/
y.prototype.method(param)/* works fine */
/*I also attempted to*/
let object = y();
I am working on creating an npm package and typing the prototype each time is inconvenient. How can I resolve this issue?