Skip to content

Commit

Permalink
Fix file object not being updated for subsequent files, related to #50
Browse files Browse the repository at this point in the history
  • Loading branch information
lazd committed Jun 20, 2017
1 parent a69f1d9 commit 6692191
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ var Transform = require('readable-stream/transform');
var rs = require('replacestream');
var istextorbinary = require('istextorbinary');

module.exports = function(search, replacement, options) {
module.exports = function(search, _replacement, options) {
return new Transform({
objectMode: true,
transform: function(file, enc, callback) {
if (file.isNull()) {
return callback(null, file);
}

if (typeof replacement === 'function') {
var replacement = _replacement;
if (typeof _replacement === 'function') {
// Pass the vinyl file object as this.file
replacement = replacement.bind({ file: file });
replacement = _replacement.bind({ file: file });
}

function doReplace() {
Expand Down

0 comments on commit 6692191

Please sign in to comment.