Nemo's Parental Misguidance

    @silen/is-stream
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    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

    Install

    npm i @silen/is-stream

    DownloadsWeekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    12.2 kB

    Total Files

    9

    Last publish

    Collaborators

    • silentsun