VeryModel
VeryModel copied to clipboard
How to determine if model was created from a factory?
What's the equivalent of foo instanceof Foo when using VeryModel?
The model instance stores a reference to the factory in __verymeta.model but this isn't exposed via the API.
Having a method that accesses that would be a good way to go about it.
What I've done so far is implement this, but would be awesome if it was built in:
MyModel.is = function (o) {
if (o && o.__verymeta && o.__verymeta.model) {
return o.__verymeta.model === this;
}
return false;
};