This commit is contained in:
sentsin
2017-08-21 08:50:25 +08:00
parent 06c11ba9cd
commit 7feaa4eca0
1899 changed files with 181363 additions and 22513 deletions

1
node_modules/ternary-stream/.jshintignore generated vendored Normal file
View File

@@ -0,0 +1 @@
node_modules/**

19
node_modules/ternary-stream/.jshintrc generated vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"regexp": true,
"strict": true,
"trailing": true,
"undef": true,
"unused": true,
"node": true
}

10
node_modules/ternary-stream/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,10 @@
.DS_Store
*.log
node_modules
build
*.node
components
*.orig
.idea
temp.txt*
test

8
node_modules/ternary-stream/.travis.yml generated vendored Normal file
View File

@@ -0,0 +1,8 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "4"
- "5"
- "6"
- "7"

20
node_modules/ternary-stream/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2014 [Richardson & Sons, LLC](http://richardsonandsons.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.

112
node_modules/ternary-stream/README.md generated vendored Normal file
View File

@@ -0,0 +1,112 @@
ternary-stream ![status](https://secure.travis-ci.org/robrich/ternary-stream.png?branch=master)
=======
A ternary stream: conditionally control the flow of stream data
## Usage
1: Conditionally filter content
**Condition**
![][condition]
if the condition returns truthy, data is piped to the child stream
```js
var ternaryStream = require('ternary-stream');
var condition = function (data) {
return true;
};
process.stdin
.pipe(ternaryStream(condition, process.stdout))
.pipe(fs.createWriteStream('./out.txt'));
```
Data will conditionally go to stdout, and always go to the file
2: Ternary stream
**Ternary**
![][ternary]
```javascript
var ternaryStream = require('ternary-stream');
var through2 = require('through2');
var count = 0;
var condition = function (data) {
count++;
return count % 2;
};
process.stdin
.pipe(ternaryStream(condition, fs.createWriteStream('./truthy.txt'), fs.createWriteStream('./falsey.txt')))
.pipe(process.stdout);
```
Data will either go to truthy.txt (if condition is true) or falsey.txt (if condition is false) and will always go to stdout
## API
### ternaryStream(condition, stream [, elseStream])
ternary-stream will pipe data to `stream` whenever `condition` is truthy.
If `condition` is falsey and `elseStream` is passed, data will pipe to `elseStream`.
After data is piped to `stream` or `elseStream` or neither, data is piped down-stream.
#### Parameters
##### condition
Type: `function`: takes in stream data and returns `boolean`
```js
function (data) {
return true; // or false
}
```
##### stream
Stream for ternary-stream to pipe data into when condition is truthy.
##### elseStream
Optional, Stream for ternary-stream to pipe data into when condition is falsey.
LICENSE
-------
(MIT License)
Copyright (c) 2014 [Richardson & Sons, LLC](http://richardsonandsons.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.
[condition]: https://rawgithub.com/robrich/ternary-stream/master/img/condition.svg
[ternary]: https://rawgithub.com/robrich/ternary-stream/master/img/ternary.svg

1
node_modules/ternary-stream/img/condition.svg generated vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.2 KiB

1
node_modules/ternary-stream/img/ternary.svg generated vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

55
node_modules/ternary-stream/index.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
'use strict';
var through2 = require('through2');
var ForkStream = require('fork-stream');
var mergeStream = require('merge-stream');
var duplexify = require('duplexify');
module.exports = function (condition, trueStream, falseStream) {
if (!trueStream) {
throw new Error('fork-stream: child action is required');
}
// output stream
var outStream = through2.obj();
// create fork-stream
var forkStream = new ForkStream({
classifier: function (e, cb) {
var ans = !!condition(e);
return cb(null, ans);
}
});
// if condition is true, pipe input to trueStream
forkStream.a.pipe(trueStream);
var mergedStream;
if (falseStream) {
// if there's an 'else' condition
// if condition is false
// pipe input to falseStream
forkStream.b.pipe(falseStream);
// merge output with trueStream's output
mergedStream = mergeStream(falseStream, trueStream);
// redirect falseStream errors to mergedStream
falseStream.on('error', function(err) { mergedStream.emit('error', err); });
} else {
// if there's no 'else' condition
// if condition is false
// merge output with trueStream's output
mergedStream = mergeStream(forkStream.b, trueStream);
}
// redirect trueStream errors to mergedStream
trueStream.on('error', function(err) { mergedStream.emit('error', err); });
// send everything down-stream
mergedStream.pipe(outStream);
// redirect mergedStream errors to outStream
mergedStream.on('error', function(err) { outStream.emit('error', err); });
// consumers write in to forkStream, we write out to outStream
return duplexify.obj(forkStream, outStream);
};

102
node_modules/ternary-stream/package.json generated vendored Normal file
View File

@@ -0,0 +1,102 @@
{
"_args": [
[
{
"raw": "ternary-stream@^2.0.1",
"scope": null,
"escapedName": "ternary-stream",
"name": "ternary-stream",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
},
"D:\\web\\layui\\res\\layui\\node_modules\\gulp-if"
]
],
"_from": "ternary-stream@>=2.0.1 <3.0.0",
"_id": "ternary-stream@2.0.1",
"_inCache": true,
"_location": "/ternary-stream",
"_nodeVersion": "6.9.1",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/ternary-stream-2.0.1.tgz_1478374690339_0.5152069262694567"
},
"_npmUser": {
"name": "robrich",
"email": "robrich@robrich.org"
},
"_npmVersion": "3.10.8",
"_phantomChildren": {},
"_requested": {
"raw": "ternary-stream@^2.0.1",
"scope": null,
"escapedName": "ternary-stream",
"name": "ternary-stream",
"rawSpec": "^2.0.1",
"spec": ">=2.0.1 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/gulp-if"
],
"_resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-2.0.1.tgz",
"_shasum": "064e489b4b5bf60ba6a6b7bc7f2f5c274ecf8269",
"_shrinkwrap": null,
"_spec": "ternary-stream@^2.0.1",
"_where": "D:\\web\\layui\\res\\layui\\node_modules\\gulp-if",
"author": {
"name": "Rob Richardson",
"url": "http://robrich.org/"
},
"bugs": {
"url": "https://github.com/robrich/ternary-stream/issues"
},
"dependencies": {
"duplexify": "^3.5.0",
"fork-stream": "^0.0.4",
"merge-stream": "^1.0.0",
"through2": "^2.0.1"
},
"description": "Fork stream based on passed condition, and collect down-stream",
"devDependencies": {
"jshint": "^2.9.4",
"mocha": "^3.1.2",
"should": "^11.1.1"
},
"directories": {},
"dist": {
"shasum": "064e489b4b5bf60ba6a6b7bc7f2f5c274ecf8269",
"tarball": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-2.0.1.tgz"
},
"engines": {
"node": ">= 0.10.0"
},
"gitHead": "7a4cb6dbfec47c5e1b5815092ada55263cd857f0",
"homepage": "https://github.com/robrich/ternary-stream",
"keywords": [
"conditional",
"if",
"ternary",
"stream"
],
"license": "MIT",
"main": "./index.js",
"maintainers": [
{
"name": "robrich",
"email": "robrich@robrich.org"
}
],
"name": "ternary-stream",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git://github.com/robrich/ternary-stream.git"
},
"scripts": {
"test": "mocha && jshint ."
},
"version": "2.0.1"
}