forked from orbit-oss/is
Readme improvements
This commit is contained in:
parent
d4869045c2
commit
69bbf2d4be
1 changed files with 10 additions and 5 deletions
15
readme.md
15
readme.md
|
|
@ -100,6 +100,8 @@ Keep in mind that [functions are objects too](https://developer.mozilla.org/en-U
|
||||||
|
|
||||||
Returns `true` for a string that represents a number. For example, `'42'` and `'-8'`.
|
Returns `true` for a string that represents a number. For example, `'42'` and `'-8'`.
|
||||||
|
|
||||||
|
Note: `'NaN'` return `false`, but `'Infinity'` and `'-Infinity'` return `true`.
|
||||||
|
|
||||||
##### .regExp(value)
|
##### .regExp(value)
|
||||||
##### .date(value)
|
##### .date(value)
|
||||||
##### .error(value)
|
##### .error(value)
|
||||||
|
|
@ -236,7 +238,7 @@ Returns `true` if `value` is a direct instance of `class`.
|
||||||
is.directInstanceOf(new Error(), Error);
|
is.directInstanceOf(new Error(), Error);
|
||||||
//=> true
|
//=> true
|
||||||
|
|
||||||
class UnicornError extends Error {};
|
class UnicornError extends Error {}
|
||||||
|
|
||||||
is.directInstanceOf(new UnicornError(), Error);
|
is.directInstanceOf(new UnicornError(), Error);
|
||||||
//=> false
|
//=> false
|
||||||
|
|
@ -289,7 +291,7 @@ An object is plain if it's created by either `{}`, `new Object()`, or `Object.cr
|
||||||
##### .asyncIterable(value)
|
##### .asyncIterable(value)
|
||||||
##### .class(value)
|
##### .class(value)
|
||||||
|
|
||||||
Returns `true` for instances created by a ES2015 class.
|
Returns `true` for instances created by a class.
|
||||||
|
|
||||||
##### .typedArray(value)
|
##### .typedArray(value)
|
||||||
|
|
||||||
|
|
@ -301,10 +303,11 @@ A `value` is array-like if it is not a function and has a `value.length` that is
|
||||||
is.arrayLike(document.forms);
|
is.arrayLike(document.forms);
|
||||||
//=> true
|
//=> true
|
||||||
|
|
||||||
function () {
|
function foo() {
|
||||||
is.arrayLike(arguments);
|
is.arrayLike(arguments);
|
||||||
//=> true
|
//=> true
|
||||||
}
|
}
|
||||||
|
foo();
|
||||||
```
|
```
|
||||||
|
|
||||||
##### .inRange(value, range)
|
##### .inRange(value, range)
|
||||||
|
|
@ -335,6 +338,7 @@ Returns `true` if `value` is a Node.js [stream](https://nodejs.org/api/stream.ht
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
is.nodeStream(fs.createReadStream('unicorn.png'));
|
is.nodeStream(fs.createReadStream('unicorn.png'));
|
||||||
//=> true
|
//=> true
|
||||||
```
|
```
|
||||||
|
|
@ -345,6 +349,7 @@ Returns `true` if `value` is an `Observable`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const {Observable} = require('rxjs');
|
const {Observable} = require('rxjs');
|
||||||
|
|
||||||
is.observable(new Observable());
|
is.observable(new Observable());
|
||||||
//=> true
|
//=> true
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue