I would like to be able to make a dynamic objet in nodejs, which when a poperty is accessed, a function is called with the property name. As an example is far more explicit than a text:
// what I am seeking
obj.get = function(name) {
return "Hello, "+ name
}
console.log(obj.foo); // Excpected : Hello, foo
console.log(obj.bar); // Excpected : Hello, bar
EDIT:
I know there is Proxy, but they don't exist in node.js. How to do that in nodejs?