@silen/is-stream
v1.0.3
Published
Check if the parameter is stream
Downloads
6
Maintainers
Readme
is-stream
Determine if a value is Stream
install
npm i @silen/is-stream
api
declare function isStream(val: any): boolean;
usage
const { isStream } = require('@silen/is-stream');
// or
import { isStream } from '@silen/is-stream';
console.log(isStream(new Buffer(4)));
console.log(isStream(Buffer.alloc(4)));
console.log(isStream(undefined));
console.log(isStream(null));
console.log(isStream(''));
console.log(isStream(true));
console.log(isStream(0));
console.log(isStream(1));
console.log(isStream(1.0));
console.log(isStream('string'));
console.log(isStream({}));
console.log(isStream(function foo() {}));
console.log(isStream(Symbol()));
console.log(isStream(new Set));
console.log(isStream(new Map));
console.log(isStream(new WeakMap));
console.log(isStream(new WeakSet));
// or
console.log(window.Type.isStream(new WeakSet));
This is a demo for testing the usage of isStream
from @silen/is-stream
module. You can try the others and do likewise.
others
- type
- isArray
- isUndefined
- isNull
- isBoolean
- isBuffer
- isArrayBuffer
- isFormData
- isArrayBufferView
- isString
- isNumber
- isObject
- isPlainObject
- isDate
- isArguments
- isFile
- isBlob
- isFunction
- isSymbol
- isRegExp
- isInt8Array
- isUint8Array
- isUint8ClampedArray
- isInt16Array
- isUint16Array
- isInt32Array
- isUint32Array
- isFloat32Array
- isFloat64Array
- isError
- isPromise
- isSet
- isWeakSet
- isMap
- isWeakMap
- isURLSearchParams