Checks if a provided value is an instance of the provided class
This does not throw for some cases where JavaScript chokes ()
possibly an instance of a class
a class constructor (usually starts with big letter!)
isA({}, Object) => trueisA(Promise.resolve, Promise) => trueisA(/hello/i, RegExp) => trueisA('plain str', String) => falseisA(new String('str obj'), String) => trueisA(22, Number) => falseisA(new Number(33), Number) => trueisA(2, NaN) => false // Note that `2 instanceof NaN` throws Copy
isA({}, Object) => trueisA(Promise.resolve, Promise) => trueisA(/hello/i, RegExp) => trueisA('plain str', String) => falseisA(new String('str obj'), String) => trueisA(22, Number) => falseisA(new Number(33), Number) => trueisA(2, NaN) => false // Note that `2 instanceof NaN` throws
if classConstructor is not a function.
classConstructor
Checks if a provided value is an instance of the provided class
This does not throw for some cases where JavaScript chokes ()