Tests whether an unknown value is an Object subtype (e.g., arrays, functions, objects, regexes,
new Number(0), new String(''), and new Boolean(true)). Tests that wish to distinguish objects that
were created from literals or that otherwise were not created via a non-Object constructor and do
not have a prototype chain should instead use isPlainObject.
Use of the type parameter T to further narrow the type signature of the value being tested is
strongly discouraged unless you are completely confident that the value is of the necessary shape to
conform with T. This function does nothing at either compile time or runtime to prove the value is of
shape T, so doing so amounts to nothing more than performing a type assertion, which is generally a
bad practice unless you have performed some other due diligence in proving that the value must be of
shape T. Use of the functions in the has co-library are useful for performing such full or partial
proofs.
Tests whether an
unknown
value is anObject
subtype (e.g., arrays, functions, objects, regexes, new Number(0), new String(''), and new Boolean(true)). Tests that wish to distinguish objects that were created from literals or that otherwise were not created via a non-Object
constructor and do not have a prototype chain should instead use isPlainObject.Use of the type parameter
T
to further narrow the type signature of the value being tested is strongly discouraged unless you are completely confident that the value is of the necessary shape to conform withT
. This function does nothing at either compile time or runtime to prove the value is of shapeT
, so doing so amounts to nothing more than performing a type assertion, which is generally a bad practice unless you have performed some other due diligence in proving that the value must be of shapeT
. Use of the functions in thehas
co-library are useful for performing such full or partial proofs.