-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add more strict check for streams in `util.isStream()' (#628)
* fix: add more strict check for streams in `util.isStream()' * fix: split `isReadable()` & `isWritable()` for more specific checks * fix: delete was not working to remove `destroy()`
- Loading branch information
1 parent
858a0f4
commit f098adf
Showing
4 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict' | ||
|
||
const t = require('tap') | ||
const { test } = t | ||
const { Stream } = require('stream') | ||
const { EventEmitter } = require('events') | ||
|
||
const util = require('../lib/core/util') | ||
|
||
test('isStream', (t) => { | ||
t.plan(3) | ||
|
||
const stream = new Stream() | ||
t.ok(util.isStream(stream)) | ||
|
||
const buffer = Buffer.alloc(0) | ||
t.notOk(util.isStream(buffer)) | ||
|
||
const ee = new EventEmitter() | ||
t.notOk(util.isStream(ee)) | ||
}) |