assemble-streams
Advanced tools
+14
-5
@@ -10,5 +10,5 @@ /*! | ||
| var utils = require('./utils'); | ||
| module.exports = function fn(app) { | ||
| var utils = require('./utils'); | ||
@@ -30,3 +30,3 @@ /** | ||
| app.mixin('toStream', function (name) { | ||
| app.mixin('toStream', function (name, filterFn) { | ||
| var stream = utils.through.obj(); | ||
@@ -50,4 +50,6 @@ var src = utils.srcStream; | ||
| for (var key in views) { | ||
| var view = views[key]; | ||
| stream.write(view); | ||
| if (!filter(key, views[key], filterFn)) { | ||
| continue; | ||
| } | ||
| stream.write(views[key]); | ||
| } | ||
@@ -60,3 +62,10 @@ stream.end(); | ||
| if (app.isApp) return fn; | ||
| }; | ||
| }; | ||
| function filter(key, view, fn) { | ||
| if (typeof fn === 'function') { | ||
| return fn(key, view); | ||
| } | ||
| return true; | ||
| } |
+4
-4
| { | ||
| "name": "assemble-streams", | ||
| "description": "Assemble plugin that adds convenience methods for working with streams, like `toStream`, which pushes a view collection into a vinyl stream.", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "homepage": "https://github.com/jonschlinkert/assemble-streams", | ||
@@ -24,3 +24,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
| "dependencies": { | ||
| "lazy-cache": "^0.2.3", | ||
| "lazy-cache": "^0.2.4", | ||
| "src-stream": "^0.1.1", | ||
@@ -31,3 +31,3 @@ "through2": "^2.0.0" | ||
| "mocha": "*", | ||
| "templates": "^0.3.1" | ||
| "templates": "^0.5.0" | ||
| }, | ||
@@ -49,2 +49,2 @@ "keywords": [ | ||
| } | ||
| } | ||
| } |
6363
2.96%70
12.9%Updated