-
-
Notifications
You must be signed in to change notification settings - Fork 810
/
Copy pathindex.js
53 lines (40 loc) · 1.01 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
var stream = require( 'stream' );
var transformStream = require( '@stdlib/streams/utils/transform' );
var isNodeStreamLike = require( './../lib' );
var bool = isNodeStreamLike( new stream.Stream() );
console.log( bool );
// => true
bool = isNodeStreamLike( new stream.Readable() );
console.log( bool );
// => true
bool = isNodeStreamLike( new stream.Writable() );
console.log( bool );
// => true
bool = isNodeStreamLike( new stream.Duplex() );
console.log( bool );
// => true
bool = isNodeStreamLike( new stream.Transform() );
console.log( bool );
// => true
bool = isNodeStreamLike( transformStream() );
console.log( bool );
// => true
bool = isNodeStreamLike( {} );
console.log( bool );
// => false
bool = isNodeStreamLike( [] );
console.log( bool );
// => false
bool = isNodeStreamLike( null );
console.log( bool );
// => false
function Stream() {
return this;
}
bool = isNodeStreamLike( Stream );
console.log( bool );
// => false
bool = isNodeStreamLike( new Stream() );
console.log( bool );
// => false