Add production dependencies

This commit is contained in:
Jay Trees 2022-01-21 09:28:41 +01:00
parent 5a0114f3e2
commit 579ccdc29f
12113 changed files with 978046 additions and 3 deletions

1
node_modules/fork-stream/.npmignore generated vendored Normal file
View file

@ -0,0 +1 @@
/node_modules

3
node_modules/fork-stream/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.10"

26
node_modules/fork-stream/LICENSE.md generated vendored Normal file
View file

@ -0,0 +1,26 @@
Copyright (c) 2013, Deoxxa Development
======================================
All rights reserved.
--------------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Deoxxa Development nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DEOXXA DEVELOPMENT ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DEOXXA DEVELOPMENT BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

135
node_modules/fork-stream/README.md generated vendored Normal file
View file

@ -0,0 +1,135 @@
fork-stream [![build status](https://travis-ci.org/deoxxa/fork-stream.png)](https://travis-ci.org/deoxxa/fork-stream)
===========
Fork a stream in multiple directions according to a function.
Overview
--------
fork-stream basically gives you conditional branching for streams. You supply
the logic, fork-stream supplies the streaming.
Super Quickstart
----------------
Code:
```javascript
var ForkStream = require("fork-stream");
var fork = new ForkStream({
classifier: function classify(e, done) {
return done(null, e.match(/[aeiou]/));
},
});
fork.a.on("data", console.log.bind(console, "vowels:"));
fork.b.on("data", console.log.bind(console, "no vowels:"));
fork.write("hello");
fork.write("zxcbzz");
fork.write("ooooooo");
fork.end();
```
Output:
```
vowels: hello
no vowels: zxcbzz
vowels: ooooooo
```
Installation
------------
Available via [npm](http://npmjs.org/):
> $ npm install fork-stream
Or via git:
> $ git clone git://github.com/deoxxa/fork-stream.git node_modules/fork-stream
API
---
**constructor**
Creates a new fork-stream.
```javascript
new ForkStream(options);
```
```javascript
var fork = new ForkStream({
highWaterMark: 5,
classifier: function(e, done) {
return done(null, !!e);
},
});
```
* _options_ - regular stream options, and a `classifier` property that
fork-stream will use to decide what output stream to send your object down.
Example
-------
Also see [example.js](https://github.com/deoxxa/fork-stream/blob/master/example.js).
```javascript
var ForkStream = require("fork-stream");
var fork = new ForkStream({
classifier: function classify(e, done) {
return done(null, e >= 5);
},
});
fork.a.on("data", console.log.bind(null, "a"));
fork.b.on("data", console.log.bind(null, "b"));
for (var i=0;i<20;++i) {
fork.write(Math.round(Math.random() * 10));
}
```
Output:
```
b 1
a 6
a 9
a 10
a 7
a 5
b 2
b 4
a 8
b 3
a 5
b 4
a 7
a 8
b 1
a 6
b 2
b 0
a 5
b 1
```
License
-------
3-clause BSD. A copy is included with the source.
Contact
-------
* GitHub ([deoxxa](http://github.com/deoxxa))
* Twitter ([@deoxxa](http://twitter.com/deoxxa))
* Email ([deoxxa@fknsrs.biz](mailto:deoxxa@fknsrs.biz))

16
node_modules/fork-stream/example.js generated vendored Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env node
var ForkStream = require("./");
var fork = new ForkStream({
classifier: function classify(e, done) {
return done(null, e >= 5);
},
});
fork.a.on("data", console.log.bind(null, "a"));
fork.b.on("data", console.log.bind(null, "b"));
for (var i=0;i<20;++i) {
fork.write(Math.round(Math.random() * 10));
}

57
node_modules/fork-stream/index.js generated vendored Normal file
View file

@ -0,0 +1,57 @@
var stream = require("stream");
var ForkStream = module.exports = function ForkStream(options) {
options = options || {};
options.objectMode = true;
stream.Writable.call(this, options);
if (options.classifier) {
this._classifier = options.classifier;
}
this.a = new stream.Readable(options);
this.b = new stream.Readable(options);
var self = this;
var resume = function resume() {
if (self.resume) {
var r = self.resume;
self.resume = null;
r.call(null);
}
};
this.a._read = resume;
this.b._read = resume;
this.on("finish", function() {
self.a.push(null);
self.b.push(null);
});
};
ForkStream.prototype = Object.create(stream.Writable.prototype, {constructor: {value: ForkStream}});
ForkStream.prototype._classifier = function(e, done) {
return done(null, !!e);
};
ForkStream.prototype._write = function _write(input, encoding, done) {
var self = this;
this._classifier.call(null, input, function(err, res) {
if (err) {
return done(err);
}
var out = res ? self.a : self.b;
if (out.push(input)) {
return done();
} else {
self.resume = done;
}
});
};

29
node_modules/fork-stream/package.json generated vendored Normal file
View file

@ -0,0 +1,29 @@
{
"name": "fork-stream",
"version": "0.0.4",
"description": "Fork a stream in multiple directions according to a function",
"main": "index.js",
"scripts": {
"test": "mocha -R tap"
},
"repository": {
"type": "git",
"url": "git://github.com/deoxxa/fork-stream.git"
},
"keywords": [
"stream",
"fork",
"split",
"function",
"conditional"
],
"author": "Conrad Pankoff <deoxxa@fknsrs.biz> (http://www.fknsrs.biz/)",
"license": "BSD",
"bugs": {
"url": "https://github.com/deoxxa/fork-stream/issues"
},
"devDependencies": {
"mocha": "~1.12.1",
"chai": "~1.7.2"
}
}

94
node_modules/fork-stream/test/tests.js generated vendored Normal file
View file

@ -0,0 +1,94 @@
var assert = require("chai").assert;
var ForkStream = require("../");
describe("fork-stream", function() {
it("should split objects into their correct streams", function(done) {
var fork = new ForkStream({
classifier: function classify(e, done) {
return done(null, e >= 5);
},
});
var expectedA = [5, 7, 9],
expectedB = [1, 4, 3, 1];
var actualA = [],
actualB = [];
fork.a.on("data", function(e) {
actualA.push(e);
});
fork.b.on("data", function(e) {
actualB.push(e);
});
fork.on("finish", function() {
assert.deepEqual(expectedA, actualA);
assert.deepEqual(expectedB, actualB);
return done();
});
[1, 5, 7, 4, 9, 3, 1].forEach(function(n) {
fork.write(n);
});
fork.end();
});
it("should respect backpressure", function(done) {
var fork = new ForkStream({
highWaterMark: 2,
classifier: function classify(e, done) {
return done(null, e >= 5);
},
});
var expected = [5, 7],
actual = [];
fork.a.on("data", function(e) {
actual.push(e);
});
var timeout = setTimeout(function() {
assert.deepEqual(expected, actual);
return done();
}, 10);
fork.on("finish", function() {
clearTimeout(timeout);
return done(Error("should not finish"));
});
[1, 5, 7, 4, 9, 3, 1].forEach(function(n) {
fork.write(n);
});
fork.end();
});
it("should end the outputs when the input finishes", function(done) {
var fork = new ForkStream();
var count = 0;
var onEnd = function onEnd() {
if (++count === 2) {
return done();
}
};
fork.a.on("end", onEnd)
fork.b.on("end", onEnd);
// start "flowing" mode
fork.a.resume();
fork.b.resume();
fork.end();
});
});