push all website files

This commit is contained in:
Jacob Levine
2019-01-06 13:14:45 -06:00
parent d7301e26c3
commit d2d5d4c04e
15662 changed files with 2166516 additions and 0 deletions

View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1,5 @@
language: node_js
node_js:
- "0.10"
- '0.12'
- 'iojs'

View 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.

View File

@@ -0,0 +1,39 @@
# stream-iterate
Iterate through the values in a stream.
```
npm install stream-iterate
```
[![build status](http://img.shields.io/travis/mafintosh/stream-iterate.svg?style=flat)](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)

View 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()
}
}

View 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"
}

View 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()
})
})