diff --git a/README.md b/README.md index 6cb42e3..c54bd75 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,18 @@ getType('') // returns 'String' isType('', String) // returns true ``` +If you just want to make sure your object _inherits_ from a particular class or +`toStringTag` value, you can use `isInstanceOf()` like this: + +```js +import { isInstanceOf } from 'is-what' + +isInstanceOf(new XMLHttpRequest(), "EventTarget") +// returns true +isInstanceOf(globalThis, ReadableStream) +// returns false +``` + ## TypeScript is-what makes TypeScript know the type during if statements. This means that a check returns the type of the payload for TypeScript users.