Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
800 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 |
|
---|
| 3 | var isStream = module.exports = function (stream) {
|
---|
| 4 | return stream !== null && typeof stream === 'object' && typeof stream.pipe === 'function';
|
---|
| 5 | };
|
---|
| 6 |
|
---|
| 7 | isStream.writable = function (stream) {
|
---|
| 8 | return isStream(stream) && stream.writable !== false && typeof stream._write === 'function' && typeof stream._writableState === 'object';
|
---|
| 9 | };
|
---|
| 10 |
|
---|
| 11 | isStream.readable = function (stream) {
|
---|
| 12 | return isStream(stream) && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object';
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | isStream.duplex = function (stream) {
|
---|
| 16 | return isStream.writable(stream) && isStream.readable(stream);
|
---|
| 17 | };
|
---|
| 18 |
|
---|
| 19 | isStream.transform = function (stream) {
|
---|
| 20 | return isStream.duplex(stream) && typeof stream._transform === 'function' && typeof stream._transformState === 'object';
|
---|
| 21 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.