mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2025-09-27 07:20:19 +00:00
push all website files
This commit is contained in:
1
website/node_modules/npm/node_modules/stream-iterate/.npmignore
generated
vendored
Normal file
1
website/node_modules/npm/node_modules/stream-iterate/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
5
website/node_modules/npm/node_modules/stream-iterate/.travis.yml
generated
vendored
Normal file
5
website/node_modules/npm/node_modules/stream-iterate/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- '0.12'
|
||||
- 'iojs'
|
21
website/node_modules/npm/node_modules/stream-iterate/LICENSE
generated
vendored
Normal file
21
website/node_modules/npm/node_modules/stream-iterate/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Mathias Buus
|
||||
|
||||
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.
|
39
website/node_modules/npm/node_modules/stream-iterate/README.md
generated
vendored
Normal file
39
website/node_modules/npm/node_modules/stream-iterate/README.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# stream-iterate
|
||||
|
||||
Iterate through the values in a stream.
|
||||
|
||||
```
|
||||
npm install stream-iterate
|
||||
```
|
||||
|
||||
[](http://travis-ci.org/mafintosh/stream-iterate)
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
var iterate = require('stream-iterate')
|
||||
var from = require('from2')
|
||||
|
||||
var stream = from.obj(['a', 'b', 'c'])
|
||||
|
||||
var read = iterate(stream)
|
||||
|
||||
loop()
|
||||
|
||||
// recursively iterates through each item in the stream
|
||||
function loop () {
|
||||
read(function (err, data, next) {
|
||||
console.log(err, data)
|
||||
next()
|
||||
loop()
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
If you don't call `next` and call `read` again the same `(err, value)` pair will be returned.
|
||||
|
||||
You can use this module to implement stuff like [a streaming merge sort](https://github.com/mafintosh/stream-iterate/blob/master/test.js#L5-L47).
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
70
website/node_modules/npm/node_modules/stream-iterate/index.js
generated
vendored
Normal file
70
website/node_modules/npm/node_modules/stream-iterate/index.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var Readable = require('readable-stream').Readable
|
||||
var shift = require('stream-shift')
|
||||
|
||||
var stream2 = function (stream) {
|
||||
if (stream._readableState) return stream
|
||||
return new Readable({objectMode: true, highWaterMark: 16}).wrap(stream)
|
||||
}
|
||||
|
||||
module.exports = function (stream) {
|
||||
stream = stream2(stream)
|
||||
|
||||
var ended = false
|
||||
var data = null
|
||||
var err = null
|
||||
var destroyed = false
|
||||
var fn = null
|
||||
|
||||
var consume = function (e) {
|
||||
if (e) {
|
||||
destroyed = true
|
||||
if (stream.destroy) stream.destroy(e)
|
||||
return
|
||||
}
|
||||
|
||||
data = null
|
||||
err = null
|
||||
}
|
||||
|
||||
var onresult = function () {
|
||||
if (!fn) return
|
||||
var tmp = fn
|
||||
fn = undefined
|
||||
tmp(err, data, consume)
|
||||
}
|
||||
|
||||
var update = function () {
|
||||
if (!fn) return
|
||||
data = shift(stream)
|
||||
if (data === null && !ended) return
|
||||
onresult()
|
||||
}
|
||||
|
||||
var onend = function () {
|
||||
ended = true
|
||||
onresult()
|
||||
}
|
||||
|
||||
stream.on('readable', update)
|
||||
|
||||
stream.on('error', function (e) {
|
||||
err = e
|
||||
onresult()
|
||||
})
|
||||
|
||||
stream.on('close', function () {
|
||||
if (stream._readableState.ended) return
|
||||
onend()
|
||||
})
|
||||
|
||||
stream.on('end', onend)
|
||||
|
||||
return function (callback) {
|
||||
if (destroyed) return
|
||||
if (err) return callback(err, null, consume)
|
||||
if (data) return callback(null, data, consume)
|
||||
if (ended) return callback(null, null, consume)
|
||||
fn = callback
|
||||
update()
|
||||
}
|
||||
}
|
56
website/node_modules/npm/node_modules/stream-iterate/package.json
generated
vendored
Normal file
56
website/node_modules/npm/node_modules/stream-iterate/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_from": "stream-iterate@^1.1.0",
|
||||
"_id": "stream-iterate@1.2.0",
|
||||
"_inBundle": true,
|
||||
"_integrity": "sha1-K9fHcpbBcCpGSIuK1B95hl7s1OE=",
|
||||
"_location": "/npm/stream-iterate",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "stream-iterate@^1.1.0",
|
||||
"name": "stream-iterate",
|
||||
"escapedName": "stream-iterate",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/npm/sorted-union-stream"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/stream-iterate/-/stream-iterate-1.2.0.tgz",
|
||||
"_shasum": "2bd7c77296c1702a46488b8ad41f79865eecd4e1",
|
||||
"_spec": "stream-iterate@^1.1.0",
|
||||
"_where": "/Users/rebecca/code/npm/node_modules/sorted-union-stream",
|
||||
"author": {
|
||||
"name": "Mathias Buus",
|
||||
"url": "@mafintosh"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mafintosh/stream-iterate/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.1.5",
|
||||
"stream-shift": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Iterate through the values of a stream",
|
||||
"devDependencies": {
|
||||
"from2": "^1.3.0",
|
||||
"standard": "^3.3.2",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/mafintosh/stream-iterate",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "stream-iterate",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mafintosh/stream-iterate.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
60
website/node_modules/npm/node_modules/stream-iterate/test.js
generated
vendored
Normal file
60
website/node_modules/npm/node_modules/stream-iterate/test.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
var tape = require('tape')
|
||||
var from = require('from2')
|
||||
var iterate = require('./')
|
||||
|
||||
tape('merge sort', function (t) {
|
||||
var a = from.obj(['a', 'b', 'd', 'e', 'g', 'h'])
|
||||
var b = from.obj(['b', 'c', 'f'])
|
||||
var output = []
|
||||
|
||||
var readA = iterate(a)
|
||||
var readB = iterate(b)
|
||||
|
||||
var loop = function () {
|
||||
readA(function (err, dataA, nextA) {
|
||||
if (err) throw err
|
||||
readB(function (err, dataB, nextB) {
|
||||
if (err) throw err
|
||||
|
||||
if (!dataA && !dataB) {
|
||||
t.same(output, ['a', 'b', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], 'sorts list')
|
||||
t.end()
|
||||
return
|
||||
}
|
||||
|
||||
if (!dataB || dataA < dataB) {
|
||||
output.push(dataA)
|
||||
nextA()
|
||||
return loop()
|
||||
}
|
||||
|
||||
if (!dataA || dataA > dataB) {
|
||||
output.push(dataB)
|
||||
nextB()
|
||||
return loop()
|
||||
}
|
||||
|
||||
output.push(dataA)
|
||||
output.push(dataB)
|
||||
nextA()
|
||||
nextB()
|
||||
loop()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
loop()
|
||||
})
|
||||
|
||||
tape('error handling', function (t) {
|
||||
var a = from.obj(['a', 'b', 'd', 'e', 'g', 'h'])
|
||||
var read = iterate(a)
|
||||
|
||||
a.destroy(new Error('oh no'))
|
||||
|
||||
read(function (err) {
|
||||
t.ok(err, 'had error')
|
||||
t.same(err.message, 'oh no')
|
||||
t.end()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user