Sorry if the title doesn't make sense, I'm not sure how to explain it myself.
Basically What I want is among the lines of this:
const myFile = require('./myFile')
const schematic = myFile.model('Name', [1,2,3])
const addValues = schematic.add()
console.log(addValues)
And it should output 6 since 1+2+3 is 6.
Im not sure how to construct the file to do this.
This is my myFile.js file:
module.exports.model = (name,values) => {
// code here
return this
}
module.exports.model.add = (name,vales) => {
// Adding code
return addedNumbers
}
I'm relatively new to NodeJS so I don't have any experience doing this.