diff options
author | grant-kun <[email protected]> | 2022-09-26 11:32:15 -0500 |
---|---|---|
committer | grant-kun <[email protected]> | 2022-09-26 11:32:15 -0500 |
commit | fb1a557749b7b83e9e732df7c65cdb3f17d0400a (patch) | |
tree | 681d83ad203c94e322aa84a7e2e65d5cc679370e /node_modules/unpipe/index.js | |
parent | 34e9facde87cac19e7d68f6ffce28546d92c9979 (diff) | |
parent | 4b237cd7f3d9ebffdfc60d987c4df3c2595c3b7c (diff) |
Merge branch 'main' of https://github.com/squiresgrant/kanna-site
Diffstat (limited to 'node_modules/unpipe/index.js')
-rw-r--r-- | node_modules/unpipe/index.js | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/node_modules/unpipe/index.js b/node_modules/unpipe/index.js deleted file mode 100644 index 15c3d97..0000000 --- a/node_modules/unpipe/index.js +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * unpipe - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module exports. - * @public - */ - -module.exports = unpipe - -/** - * Determine if there are Node.js pipe-like data listeners. - * @private - */ - -function hasPipeDataListeners(stream) { - var listeners = stream.listeners('data') - - for (var i = 0; i < listeners.length; i++) { - if (listeners[i].name === 'ondata') { - return true - } - } - - return false -} - -/** - * Unpipe a stream from all destinations. - * - * @param {object} stream - * @public - */ - -function unpipe(stream) { - if (!stream) { - throw new TypeError('argument stream is required') - } - - if (typeof stream.unpipe === 'function') { - // new-style - stream.unpipe() - return - } - - // Node.js 0.8 hack - if (!hasPipeDataListeners(stream)) { - return - } - - var listener - var listeners = stream.listeners('close') - - for (var i = 0; i < listeners.length; i++) { - listener = listeners[i] - - if (listener.name !== 'cleanup' && listener.name !== 'onclose') { - continue - } - - // invoke the listener - listener.call(stream) - } -} |