Skip to content

Commit

Permalink
Merge pull request #1 from kevva/readable-stream
Browse files Browse the repository at this point in the history
Use readable-stream instead of through2
  • Loading branch information
kevva committed Jun 21, 2015
2 parents 83a06a1 + 36d8657 commit 7644767
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
25 changes: 14 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
'use strict';

var objectAssign = require('object-assign');
var through = require('through2');
var Transform = require('readable-stream/transform');

module.exports = function (opts) {
opts = opts || {};

return through.obj(function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}
return new Transform({
objectMode: true,
transform: function (file, enc, cb) {
if (file.isNull()) {
cb(null, file);
return;
}

if (file.isStream()) {
cb(new Error('Streaming is not supported'));
return;
}
if (file.isStream()) {
cb(new Error('Streaming is not supported'));
return;
}

cb(null, objectAssign(file, opts));
cb(null, objectAssign(file, opts));
}
});
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"keywords": [],
"dependencies": {
"object-assign": "^3.0.0",
"through2": "^0.6.3"
"readable-stream": "^2.0.0"
},
"devDependencies": {
"ava": "^0.0.4",
Expand Down

0 comments on commit 7644767

Please sign in to comment.