Okay I'm not sure what would you call this or what i should've used in title but what I'm trying to do is a class instance if called be one of the methods by default something like
class Something {
method() {}
another() {}
}
const instance = default(new Something(), "method");
instance(); // calls Something.prototype.method
instance.another(); // everything else should still exist
It would be something like cloning the whole prototype in a function object or something, i can't really think right now, Thanks in advance.