I have an object that contains both properties and methods:
var foo = {
bar: function(a) {},
baz: 42
}
I'm trying to restructure, moving all methods into a new methods object:
var foo = {
methods: {
bar: function(a) {},
}
baz: 42
}
Is it possible to remove foo.bar() while also preserving backwards compatibility? E.g. when a user tries foo.bar(a), it's aliased to foo.methods.bar(a)?