aboutsummaryrefslogtreecommitdiff
path: root/node_modules/is-stream
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
committerJoel Kronqvist <work.joelkronqvist@pm.me>2022-03-11 20:46:06 +0200
commit080c5819d87b933816d724a83f3bf4f1686770a7 (patch)
tree4a2ccc68b27edf7d4cbc586c932cc7542b655e19 /node_modules/is-stream
parent5ac7049a9d30733165cc212dee308163c2a14644 (diff)
parentd003b82235a9329f912522a2f70aa950dfce4998 (diff)
downloadLYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.tar.gz
LYLLRuoka-080c5819d87b933816d724a83f3bf4f1686770a7.zip
Merge branch 'master' of https://github.com/JoelHMikael/FoodJS
Updating remote changes
Diffstat (limited to 'node_modules/is-stream')
-rw-r--r--node_modules/is-stream/index.d.ts79
-rw-r--r--node_modules/is-stream/index.js28
-rw-r--r--node_modules/is-stream/license9
-rw-r--r--node_modules/is-stream/package.json42
-rw-r--r--node_modules/is-stream/readme.md60
5 files changed, 218 insertions, 0 deletions
diff --git a/node_modules/is-stream/index.d.ts b/node_modules/is-stream/index.d.ts
new file mode 100644
index 0000000..eee2e83
--- /dev/null
+++ b/node_modules/is-stream/index.d.ts
@@ -0,0 +1,79 @@
+import * as stream from 'stream';
+
+declare const isStream: {
+ /**
+ @returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
+
+ @example
+ ```
+ import * as fs from 'fs';
+ import isStream = require('is-stream');
+
+ isStream(fs.createReadStream('unicorn.png'));
+ //=> true
+
+ isStream({});
+ //=> false
+ ```
+ */
+ (stream: unknown): stream is stream.Stream;
+
+ /**
+ @returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
+
+ @example
+ ```
+ import * as fs from 'fs';
+ import isStream = require('is-stream');
+
+ isStream.writable(fs.createWriteStrem('unicorn.txt'));
+ //=> true
+ ```
+ */
+ writable(stream: unknown): stream is stream.Writable;
+
+ /**
+ @returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
+
+ @example
+ ```
+ import * as fs from 'fs';
+ import isStream = require('is-stream');
+
+ isStream.readable(fs.createReadStream('unicorn.png'));
+ //=> true
+ ```
+ */
+ readable(stream: unknown): stream is stream.Readable;
+
+ /**
+ @returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
+
+ @example
+ ```
+ import {Duplex} from 'stream';
+ import isStream = require('is-stream');
+
+ isStream.duplex(new Duplex());
+ //=> true
+ ```
+ */
+ duplex(stream: unknown): stream is stream.Duplex;
+
+ /**
+ @returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
+
+ @example
+ ```
+ import * as fs from 'fs';
+ import Stringify = require('streaming-json-stringify');
+ import isStream = require('is-stream');
+
+ isStream.transform(Stringify());
+ //=> true
+ ```
+ */
+ transform(input: unknown): input is stream.Transform;
+};
+
+export = isStream;
diff --git a/node_modules/is-stream/index.js b/node_modules/is-stream/index.js
new file mode 100644
index 0000000..2e43434
--- /dev/null
+++ b/node_modules/is-stream/index.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const isStream = stream =>
+ stream !== null &&
+ typeof stream === 'object' &&
+ typeof stream.pipe === 'function';
+
+isStream.writable = stream =>
+ isStream(stream) &&
+ stream.writable !== false &&
+ typeof stream._write === 'function' &&
+ typeof stream._writableState === 'object';
+
+isStream.readable = stream =>
+ isStream(stream) &&
+ stream.readable !== false &&
+ typeof stream._read === 'function' &&
+ typeof stream._readableState === 'object';
+
+isStream.duplex = stream =>
+ isStream.writable(stream) &&
+ isStream.readable(stream);
+
+isStream.transform = stream =>
+ isStream.duplex(stream) &&
+ typeof stream._transform === 'function';
+
+module.exports = isStream;
diff --git a/node_modules/is-stream/license b/node_modules/is-stream/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/node_modules/is-stream/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/is-stream/package.json b/node_modules/is-stream/package.json
new file mode 100644
index 0000000..c3b5673
--- /dev/null
+++ b/node_modules/is-stream/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "is-stream",
+ "version": "2.0.1",
+ "description": "Check if something is a Node.js stream",
+ "license": "MIT",
+ "repository": "sindresorhus/is-stream",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "stream",
+ "type",
+ "streams",
+ "writable",
+ "readable",
+ "duplex",
+ "transform",
+ "check",
+ "detect",
+ "is"
+ ],
+ "devDependencies": {
+ "@types/node": "^11.13.6",
+ "ava": "^1.4.1",
+ "tempy": "^0.3.0",
+ "tsd": "^0.7.2",
+ "xo": "^0.24.0"
+ }
+}
diff --git a/node_modules/is-stream/readme.md b/node_modules/is-stream/readme.md
new file mode 100644
index 0000000..19308e7
--- /dev/null
+++ b/node_modules/is-stream/readme.md
@@ -0,0 +1,60 @@
+# is-stream
+
+> Check if something is a [Node.js stream](https://nodejs.org/api/stream.html)
+
+## Install
+
+```
+$ npm install is-stream
+```
+
+## Usage
+
+```js
+const fs = require('fs');
+const isStream = require('is-stream');
+
+isStream(fs.createReadStream('unicorn.png'));
+//=> true
+
+isStream({});
+//=> false
+```
+
+## API
+
+### isStream(stream)
+
+Returns a `boolean` for whether it's a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
+
+#### isStream.writable(stream)
+
+Returns a `boolean` for whether it's a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
+
+#### isStream.readable(stream)
+
+Returns a `boolean` for whether it's a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
+
+#### isStream.duplex(stream)
+
+Returns a `boolean` for whether it's a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
+
+#### isStream.transform(stream)
+
+Returns a `boolean` for whether it's a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
+
+## Related
+
+- [is-file-stream](https://github.com/jamestalmage/is-file-stream) - Detect if a stream is a file stream
+
+---
+
+<div align="center">
+ <b>
+ <a href="https://tidelift.com/subscription/pkg/npm-is-stream?utm_source=npm-is-stream&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+ </b>
+ <br>
+ <sub>
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+ </sub>
+</div>