Make an assertion that obj is an instance of type. If not then throw.
obj
type
Optional
24.7.0
import { assertInstanceOf } from "assert";assertInstanceOf(new Date(), Date); // Doesn't throwassertInstanceOf(new Date(), Number); // Throws Copy
import { assertInstanceOf } from "assert";assertInstanceOf(new Date(), Date); // Doesn't throwassertInstanceOf(new Date(), Number); // Throws
Make an assertion that
obj
is an instance oftype
. If not then throw.