@stdlib/assert-is-node-transform-stream-like
v0.2.2
Published
Test if a value is Node transform stream-like.
Downloads
21
Readme
Transform Stream-like
Test if a value is Node transform stream-like.
Installation
npm install @stdlib/assert-is-node-transform-stream-like
Usage
var isNodeTransformStreamLike = require( '@stdlib/assert-is-node-transform-stream-like' );
isNodeTransformStreamLike( value )
Tests if a value
is Node transform stream-like.
var transformStream = require( '@stdlib/streams-node-transform' );
var bool = isNodeTransformStreamLike( transformStream() );
// returns true
Examples
var stream = require( 'stream' );
var transformStream = require( '@stdlib/streams-node-transform' );
var isNodeTransformStreamLike = require( '@stdlib/assert-is-node-transform-stream-like' );
var bool = isNodeTransformStreamLike( new stream.Transform() );
// returns true
bool = isNodeTransformStreamLike( transformStream() );
// returns true
bool = isNodeTransformStreamLike( new stream.Stream() );
// returns false
bool = isNodeTransformStreamLike( new stream.Readable() );
// returns false
bool = isNodeTransformStreamLike( new stream.Writable() );
// returns false
bool = isNodeTransformStreamLike( new stream.Duplex() );
// returns false
bool = isNodeTransformStreamLike( {} );
// returns false
bool = isNodeTransformStreamLike( [] );
// returns false
bool = isNodeTransformStreamLike( null );
// returns false
function Stream() {
return this;
}
bool = isNodeTransformStreamLike( Stream );
// returns false
bool = isNodeTransformStreamLike( new Stream() );
// returns false
See Also
@stdlib/assert-is-node-stream-like
: test if a value is Node stream-like.
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.