Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract shim functionality into bun module; Depend on bun

  • Loading branch information...
commit 9f7ebe87eca6b24e531b17c8fa4cc709f377d775 1 parent 78d83ea
@naomik authored
Showing with 5 additions and 69 deletions.
  1. +2 −69 lib/burro.js
  2. +3 −0  package.json
View
71 lib/burro.js
@@ -3,76 +3,9 @@ var Encoder = exports.Encoder = require("./encoder"),
Framer = exports.Framer = require("./framer"),
Unframer = exports.Unframer = require("./unframer");
-var stream = require("stream");
-
-var shim = function shim(streams) {
- var inner = new stream.Duplex({objectMode: true}),
- outer = new stream.Duplex({objectMode: true});
-
- inner.once("error", function onError(err) {
- outer.emit("error", err);
- });
-
- inner.once("finish", function onFinish() {
- outer.push(null);
- });
-
- inner.once("end", function onEnd() {
- outer.end();
- });
-
- outer.once("error", function onError(err) {
- inner.emit("error", err);
- });
-
- outer.once("finish", function onFinish() {
- inner.push(null);
- });
-
- outer.once("end", function onEnd() {
- inner.end();
- });
-
- inner._write = function _write(input, encoding, done) {
- if (outer.push(input)) {
- return done();
- } else {
- this.continue = done;
- }
- };
-
- inner._read = function _read(size) {
- if (outer.continue) {
- outer.continue();
- delete outer.continue;
- }
- };
-
- outer._write = function _write(input, encoding, done) {
- if (inner.push(input)) {
- return done();
- } else {
- this.continue = done;
- }
- };
-
- outer._read = function _read(size) {
- if (inner.continue) {
- inner.continue();
- delete inner.continue;
- }
- };
-
- var s = inner;
- streams.concat([inner]).forEach(function(other) {
- s = s.pipe(other);
- });
-
- return outer;
-};
-
+var bun = require("bun");
exports.wrap = function wrap(metal) {
- return shim([
+ return bun([
new Encoder(),
new Framer(),
metal,
View
3  package.json
@@ -24,5 +24,8 @@
"devDependencies": {
"mocha": "~1.8.1",
"hiccup": "~0.1.4"
+ },
+ "dependencies": {
+ "bun": "0.0.1"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.