Travis build: 586
This commit is contained in:
113
README.md
113
README.md
@ -353,7 +353,11 @@ average(1, 2, 3);
|
||||
* [`colorize`](#colorize)
|
||||
* [`hasFlags`](#hasflags)
|
||||
* [`hashNode`](#hashnode)
|
||||
* [`isDuplexStream`](#isduplexstream)
|
||||
* [`isReadableStream`](#isreadablestream)
|
||||
* [`isStream`](#isstream)
|
||||
* [`isTravisCI`](#istravisci)
|
||||
* [`isWritableStream`](#iswritablestream)
|
||||
* [`JSONToFile`](#jsontofile)
|
||||
* [`readFileLines`](#readfilelines)
|
||||
* [`untildify`](#untildify)
|
||||
@ -6290,6 +6294,87 @@ hashNode(JSON.stringify({ a: 'a', b: [1, 2, 3, 4], foo: { c: 'bar' } })).then(co
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isDuplexStream
|
||||
|
||||
Checks if the given argument is a duplex (readable and writable) stream.
|
||||
|
||||
Check if the value is different from `null`, use `typeof` to check if a value is of type `object` and the `pipe` property is of type `function`.
|
||||
Additionally check if the `typeof` the `_read`, `_write` and `_readableState`, `_writableState` properties are `function` and `object` respectively.
|
||||
|
||||
```js
|
||||
const isDuplexStream = val =>
|
||||
val !== null &&
|
||||
typeof val === 'object' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val._read === 'function' &&
|
||||
typeof val._readableState === 'object' &&
|
||||
typeof val._write === 'function' &&
|
||||
typeof val._writableState === 'object';
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
const Stream = require('stream');
|
||||
isDuplexStream(new Stream.Duplex()); // true
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isReadableStream
|
||||
|
||||
Checks if the given argument is a readable stream.
|
||||
|
||||
Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
|
||||
Additionally check if the `typeof` the `_read` and `_readableState` properties are `function` and `object` respectively.
|
||||
|
||||
```js
|
||||
const isReadableStream = val =>
|
||||
val !== null &&
|
||||
typeof val === 'object' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val._read === 'function' &&
|
||||
typeof val._readableState === 'object';
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
isReadableStream(fs.createReadStream('test.txt')); // true
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isStream
|
||||
|
||||
Checks if the given argument is a stream.
|
||||
|
||||
Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
|
||||
|
||||
```js
|
||||
const isStream = val => val !== null && typeof val === 'object' && typeof val.pipe === 'function';
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
isStream(fs.createReadStream('test.txt')); // true
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isTravisCI
|
||||
|
||||
Checks if the current environment is [Travis CI](https://travis-ci.org/).
|
||||
@ -6311,6 +6396,34 @@ isTravisCI(); // true (if code is running on Travis CI)
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### isWritableStream
|
||||
|
||||
Checks if the given argument is a writable stream.
|
||||
|
||||
Check if the value is different from `null`, use `typeof` to check if the value is of type `object` and the `pipe` property is of type `function`.
|
||||
Additionally check if the `typeof` the `_write` and `_writableState` properties are `function` and `object` respectively.
|
||||
|
||||
```js
|
||||
const isWritableStream = val =>
|
||||
val !== null &&
|
||||
typeof val === 'object' &&
|
||||
typeof val.pipe === 'function' &&
|
||||
typeof val._write === 'function' &&
|
||||
typeof val._writableState === 'object';
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
isWritableStream(fs.createWriteStream('test.txt')); // true
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
### JSONToFile
|
||||
|
||||
Writes a JSON object to a file.
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user