Add production dependencies
This commit is contained in:
parent
5a0114f3e2
commit
579ccdc29f
12113 changed files with 978046 additions and 3 deletions
20
node_modules/ordered-read-streams/LICENSE
generated
vendored
Normal file
20
node_modules/ordered-read-streams/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Artem Medeusheyev
|
||||
|
||||
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.
|
65
node_modules/ordered-read-streams/README.md
generated
vendored
Normal file
65
node_modules/ordered-read-streams/README.md
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
# ordered-read-streams [](http://badge.fury.io/js/ordered-read-streams) [](https://travis-ci.org/armed/ordered-read-streams)
|
||||
|
||||
Combines array of streams into one read stream in strict order.
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install ordered-read-streams`
|
||||
|
||||
## Overview
|
||||
|
||||
`ordered-read-streams` handles all data/errors from input streams in parallel, but emits data/errors in strict order in which streams are passed to constructor. This is `objectMode = true` stream.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var through = require('through2');
|
||||
var Ordered = require('ordered-read-streams');
|
||||
|
||||
var s1 = through.obj(function (data, enc, next) {
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.push(data);
|
||||
next();
|
||||
}, 200)
|
||||
});
|
||||
var s2 = through.obj(function (data, enc, next) {
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.push(data);
|
||||
next();
|
||||
}, 30)
|
||||
});
|
||||
var s3 = through.obj(function (data, enc, next) {
|
||||
var self = this;
|
||||
setTimeout(function () {
|
||||
self.push(data);
|
||||
next();
|
||||
}, 100)
|
||||
});
|
||||
|
||||
var streams = new Ordered([s1, s2, s3]);
|
||||
streams.on('data', function (data) {
|
||||
console.log(data);
|
||||
})
|
||||
|
||||
s1.write('stream 1');
|
||||
s1.end();
|
||||
|
||||
s2.write('stream 2');
|
||||
s2.end();
|
||||
|
||||
s3.write('stream 3');
|
||||
s3.end();
|
||||
```
|
||||
Ouput will be:
|
||||
|
||||
```
|
||||
stream 1
|
||||
stream 2
|
||||
stream 3
|
||||
```
|
||||
|
||||
## Licence
|
||||
|
||||
MIT
|
99
node_modules/ordered-read-streams/index.js
generated
vendored
Normal file
99
node_modules/ordered-read-streams/index.js
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
var Readable = require('readable-stream/readable');
|
||||
var util = require('util');
|
||||
|
||||
function isReadable(stream) {
|
||||
if (typeof stream.pipe !== 'function') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stream.readable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof stream._read !== 'function') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!stream._readableState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function addStream (streams, stream) {
|
||||
if (!isReadable(stream)) {
|
||||
throw new Error('All input streams must be readable');
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
stream._buffer = [];
|
||||
|
||||
stream.on('readable', function () {
|
||||
var chunk = stream.read();
|
||||
while (chunk) {
|
||||
if (this === streams[0]) {
|
||||
self.push(chunk);
|
||||
} else {
|
||||
this._buffer.push(chunk);
|
||||
}
|
||||
chunk = stream.read();
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('end', function () {
|
||||
for (var stream = streams[0];
|
||||
stream && stream._readableState.ended;
|
||||
stream = streams[0]) {
|
||||
while (stream._buffer.length) {
|
||||
self.push(stream._buffer.shift());
|
||||
}
|
||||
|
||||
streams.shift();
|
||||
}
|
||||
|
||||
if (!streams.length) {
|
||||
self.push(null);
|
||||
}
|
||||
});
|
||||
|
||||
stream.on('error', this.emit.bind(this, 'error'));
|
||||
|
||||
streams.push(stream);
|
||||
}
|
||||
|
||||
function OrderedStreams (streams, options) {
|
||||
if (!(this instanceof(OrderedStreams))) {
|
||||
return new OrderedStreams(streams, options);
|
||||
}
|
||||
|
||||
streams = streams || [];
|
||||
options = options || {};
|
||||
|
||||
options.objectMode = true;
|
||||
|
||||
Readable.call(this, options);
|
||||
|
||||
if (!Array.isArray(streams)) {
|
||||
streams = [streams];
|
||||
}
|
||||
if (!streams.length) {
|
||||
return this.push(null); // no streams, close
|
||||
}
|
||||
|
||||
var addStreamBinded = addStream.bind(this, []);
|
||||
|
||||
streams.forEach(function (item) {
|
||||
if (Array.isArray(item)) {
|
||||
item.forEach(addStreamBinded);
|
||||
} else {
|
||||
addStreamBinded(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
util.inherits(OrderedStreams, Readable);
|
||||
|
||||
OrderedStreams.prototype._read = function () {};
|
||||
|
||||
module.exports = OrderedStreams;
|
26
node_modules/ordered-read-streams/package.json
generated
vendored
Normal file
26
node_modules/ordered-read-streams/package.json
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "ordered-read-streams",
|
||||
"version": "1.0.1",
|
||||
"description": "Combines array of streams into one read stream in strict order",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "jscs *.js test/*js && jshint *.js test/*.js && mocha"
|
||||
},
|
||||
"repository": "armed/ordered-read-streams",
|
||||
"author": "Artem Medeusheyev <artem.medeusheyev@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"expect": "^1.20.2",
|
||||
"jscs": "^1.13.1",
|
||||
"jshint": "^2.8.0",
|
||||
"mississippi": "^1.3.0",
|
||||
"mocha": "^2.2.5",
|
||||
"pre-commit": "^1.0.10",
|
||||
"through2": "^2.0.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue