I'm new to building custom npm packages and I'm getting lost configuring it with data coming from the application it is using it.
EDIT: This is just an example but the app will have more methods and those fake a and b will be used from many of those methods.
Basically on App I'm requiring my package in this way:
var a = 'a';
var b = 'b';
var module = require('module')(a, b);
module.test();
My module in his index file has:
var a;
var b;
function test() {
return {
a: a,
b: b
};
}
module.exports = function(_a, _b) {
a = _a;
b = _b;
return {
test: test
}
};
As you can guess it is not working as I was expecting... How can I pass my custom data to my npm package and be able using that data along my methods?