Is there a (creative) way to know from which module was a function called ? In order to make the code cleaner and more straightforward.
module-a.js
module.exports = {
foo = function(calledFrom){
console.log("foo() called from module: " + calledFrom)
}
}
// But ideally, something like:
module.exports = {
foo2 = function(){
console.log("foo2() called from module: " + arguments[0])
//Or any other way to achieve this generic behaviour
}
}
module-b.js
require('./module-b.js').foo('module-b')
// But ideally:
require(./module-b.js).foo2()
Coming from python, I like the philosophy of simplicity.