Add is.directInstanceOf() (#38)

This commit is contained in:
Brandon Smith 2017-12-09 11:55:08 -05:00 committed by GitHub
parent 4ce2ee9d39
commit 70b08940be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View file

@ -136,6 +136,20 @@ is.boundFunction(function () {});
#### Miscellaneous
##### .directInstanceOf(value, class)
Returns `true` if `value` is a direct instance of `class`.
```js
is.directInstanceOf(new Error(), Error);
//=> true
class UnicornError extends Error {};
is.directInstanceOf(new UnicornError(), Error);
//=> false
```
##### .truthy(value)
Returns `true` for all values that evaluate to true in a boolean context: