hyperstream
Advanced tools
Comparing version 0.5.0 to 0.5.1
23
index.js
var trumpet = require('trumpet'); | ||
var through = require('through'); | ||
var through = require('through2'); | ||
var concat = require('concat-stream'); | ||
@@ -13,7 +13,12 @@ | ||
if (typeof value === 'object' && value.pipe) { | ||
vstream = through().pause(); | ||
vstream = through(); | ||
value.pipe(vstream); | ||
} | ||
tr.selectAll(key, function (elem) { | ||
if (/:first$/.test(key)) { | ||
tr.select(key.replace(/:first$/,''), onmatch); | ||
} | ||
else tr.selectAll(key, onmatch); | ||
function onmatch (elem) { | ||
if (typeof value === 'string') { | ||
@@ -24,3 +29,2 @@ elem.createWriteStream().end(value); | ||
vstream.pipe(elem.createWriteStream()); | ||
vstream.resume(); | ||
} | ||
@@ -38,6 +42,9 @@ else if (typeof value === 'object') { | ||
stream.pipe(concat(function (body) { | ||
stream.end(value(body.toString('utf8'))); | ||
stream.end(toStr(value(body.toString('utf8')))); | ||
})); | ||
} | ||
}); | ||
else { | ||
elem.createWriteStream().end(String(value)); | ||
} | ||
} | ||
}); | ||
@@ -48,1 +55,5 @@ return tr; | ||
function isStream (s) { return s && typeof s.pipe === 'function' } | ||
function toStr (s) { | ||
if (Buffer.isBuffer(s) || typeof s === 'string') return s; | ||
return String(s); | ||
} |
{ | ||
"name" : "hyperstream", | ||
"version" : "0.5.0", | ||
"description" : "stream html into html at a css selector", | ||
"main" : "index.js", | ||
"dependencies" : { | ||
"trumpet" : "~1.6.3", | ||
"duplexer" : "~0.0.2", | ||
"through" : "~2.3.4", | ||
"concat-stream" : "~1.0.0", | ||
"throughout" : "~0.0.0" | ||
}, | ||
"devDependencies" : { | ||
"tap" : "~0.4.0", | ||
"hyperquest" : "~0.1.5" | ||
}, | ||
"scripts" : { | ||
"test" : "tap test/*.js" | ||
}, | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git://github.com/substack/hyperstream.git" | ||
}, | ||
"homepage" : "https://github.com/substack/hyperstream", | ||
"keywords" : [ | ||
"html", | ||
"stream", | ||
"streaming", | ||
"hypertext", | ||
"template", | ||
"engine" | ||
], | ||
"author" : { | ||
"name" : "James Halliday", | ||
"email" : "mail@substack.net", | ||
"url" : "http://substack.net" | ||
}, | ||
"license" : "MIT" | ||
"name": "hyperstream", | ||
"version": "0.5.1", | ||
"description": "stream html into html at a css selector", | ||
"main": "index.js", | ||
"dependencies": { | ||
"concat-stream": "^1.0.0", | ||
"through2": "~0.5.1", | ||
"trumpet": "^1.6.4" | ||
}, | ||
"devDependencies": { | ||
"through": "~2.3.4", | ||
"tap": "~0.4.0", | ||
"hyperquest": "~0.1.5" | ||
}, | ||
"scripts": { | ||
"test": "tap test/*.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/substack/hyperstream.git" | ||
}, | ||
"homepage": "https://github.com/substack/hyperstream", | ||
"keywords": [ | ||
"html", | ||
"stream", | ||
"streaming", | ||
"hypertext", | ||
"template", | ||
"engine" | ||
], | ||
"author": { | ||
"name": "James Halliday", | ||
"email": "mail@substack.net", | ||
"url": "http://substack.net" | ||
}, | ||
"license": "MIT" | ||
} |
16408
3
40
337
3
9
+ Addedthrough2@~0.5.1
+ Addedbuffer-from@1.1.2(transitive)
+ Addedconcat-stream@1.6.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrough2@0.5.1(transitive)
+ Addedtrumpet@1.7.2(transitive)
+ Addedtypedarray@0.0.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@3.0.0(transitive)
- Removedduplexer@~0.0.2
- Removedthrough@~2.3.4
- Removedthroughout@~0.0.0
- Removedbase64-js@0.0.2(transitive)
- Removedbops@0.0.6(transitive)
- Removedconcat-stream@1.0.1(transitive)
- Removedduplexer@0.0.4(transitive)
- Removedthroughout@0.0.0(transitive)
- Removedto-utf8@0.0.1(transitive)
- Removedtrumpet@1.6.6(transitive)
Updatedconcat-stream@^1.0.0
Updatedtrumpet@^1.6.4