Skip to content

Commit 6692191

Browse files
committed
Fix file object not being updated for subsequent files, related to #50
1 parent a69f1d9 commit 6692191

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ var Transform = require('readable-stream/transform');
44
var rs = require('replacestream');
55
var istextorbinary = require('istextorbinary');
66

7-
module.exports = function(search, replacement, options) {
7+
module.exports = function(search, _replacement, options) {
88
return new Transform({
99
objectMode: true,
1010
transform: function(file, enc, callback) {
1111
if (file.isNull()) {
1212
return callback(null, file);
1313
}
1414

15-
if (typeof replacement === 'function') {
15+
var replacement = _replacement;
16+
if (typeof _replacement === 'function') {
1617
// Pass the vinyl file object as this.file
17-
replacement = replacement.bind({ file: file });
18+
replacement = _replacement.bind({ file: file });
1819
}
1920

2021
function doReplace() {

0 commit comments

Comments
 (0)