Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert to pre-v0.1.0 code requirements
- Loading branch information
Showing
9 changed files
with
273 additions
and
223 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
coverage | ||
node_modules | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
sudo: false | ||
branches: | ||
except: /^v\d/ | ||
language: node_js | ||
node_js: | ||
- stable | ||
- '0' | ||
- '0.10' | ||
before_install: if [[ `npm --version` != 3* ]]; then npm install -g npm; fi; | ||
script: >- | ||
if [[ `node --version` == v0.* ]]; | ||
then npm install babel@5 && | ||
node node_modules/.bin/babel test.js --out-file test.js && | ||
node test.js; | ||
else npm test; | ||
fi; | ||
after_script: >- | ||
if [[ `node --version` != v0.* ]]; | ||
then npm install istanbul-coveralls@1 && | ||
npm run-script coverage && | ||
node node_modules/.bin/istanbul-coveralls; | ||
fi; | ||
- "0.10" | ||
- "0.12" | ||
- "4" | ||
- "5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
#!/usr/bin/env node --harmony_destructuring | ||
"use strict"; | ||
|
||
const duplexer2 = require("."); | ||
const {Readable, Writable} = require("stream"); | ||
|
||
const readable = new Readable({read() {/* no-op */}}); | ||
const writable = new Writable({ | ||
write(data, enc, cb) { | ||
if (readable.push(data)) { | ||
cb(); | ||
return; | ||
} | ||
readable.once("drain", cb); | ||
#!/usr/bin/env node | ||
|
||
var stream = require("readable-stream"); | ||
|
||
var duplexer2 = require("./"); | ||
|
||
var writable = new stream.Writable({objectMode: true}), | ||
readable = new stream.Readable({objectMode: true}); | ||
|
||
writable._write = function _write(input, encoding, done) { | ||
if (readable.push(input)) { | ||
return done(); | ||
} else { | ||
readable.once("drain", done); | ||
} | ||
}); | ||
}; | ||
|
||
readable._read = function _read(n) { | ||
// no-op | ||
}; | ||
|
||
// simulate the readable thing closing after a bit | ||
writable.once("finish", () => setTimeout(() => readable.push(null), 300)); | ||
writable.once("finish", function() { | ||
setTimeout(function() { | ||
readable.push(null); | ||
}, 500); | ||
}); | ||
|
||
var duplex = duplexer2(writable, readable); | ||
|
||
const duplex = duplexer2({}, writable, readable) | ||
.on("data", data => console.log("got data", data.toString())) | ||
.on("finish", () => console.log("got finish event")) | ||
.on("end", () => console.log("got end event")); | ||
duplex.on("data", function(e) { | ||
console.log("got data", JSON.stringify(e)); | ||
}); | ||
|
||
duplex.on("finish", function() { | ||
console.log("got finish event"); | ||
}); | ||
|
||
duplex.on("end", function() { | ||
console.log("got end event"); | ||
}); | ||
|
||
duplex.write("oh, hi there", function() { | ||
console.log("finished writing"); | ||
}); | ||
|
||
duplex.write("oh, hi there", () => console.log("finished writing")); | ||
duplex.end(() => console.log("finished ending")); | ||
duplex.end(function() { | ||
console.log("finished ending"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.