dcl.isInstanceOf()
Version 2.x
While instanceof
operator works only for linear prototypal inheritance, dcl.isInstanceOf()
is
its counterpart for mixins.
Description
JavaScript provides instanceof
operator to check if an object was produced with a certain constructor or its delegate.
Unfortunately this functionality works only for a linear delegation. Mixins are by necessity mixed in, so they cannot be
detected by instanceof
. This functionality is provided by dcl.isInstanceOf()
function, which takes the object and
the constructor as parameters, and returns true
, when the object contains the supplied mixin or base constructor, and false
otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Notes
This function has a linear complexity on a number of mixins.