How to use the is-stream.assertObjectStream function in is-stream

To help you get started, we’ve selected a few is-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catdad / grandma / lib / is-stream.js View on Github external
//
    // So we are just going to manually make this pass...
    //
    // https://github.com/nodejs/node/issues/8828
    //
    // womp womp
    if (type === 'writable' && stream === process.stdout) {
        return true;
    }

    if (!isStream[type](stream)) {
        throw new TypeError(errStr);
    }
};

isStream.assertObjectStream = function assertObjectStream(stream, type, errStr) {
    isStream.assertStream(stream, type, errStr);

    if (type === 'readable') {
        assertObjectMode(stream, '_readableState', errStr);
    } else if (type === 'writable') {
        assertObjectMode(stream, '_writableState', errStr);
    }
};

module.exports = isStream;

is-stream

Check if something is a Node.js stream

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis