Skip to content

Commit df5af41

Browse files
author
Michael J. Ryan
committed
remove event-stream from the package, only used for testing
1 parent 76934c2 commit df5af41

File tree

5 files changed

+2390
-1482
lines changed

5 files changed

+2390
-1482
lines changed

index.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
'use strict';
33

44
/**
5-
* Module dependencies.
6-
*/
5+
* Module dependencies.
6+
*/
77

88
var Concat = require('concat-with-sourcemaps');
99
var through = require('through2');
@@ -13,16 +13,21 @@ var path = require('path');
1313
var fs = require('fs');
1414

1515
/**
16-
* gulp-header plugin
17-
*/
16+
* gulp-header plugin
17+
*/
1818

19-
module.exports = function (headerText, data) {
19+
module.exports = function(headerText, data) {
2020
headerText = headerText || '';
2121

2222
function TransformStream(file, enc, cb) {
2323
// format template
2424
var filename = path.basename(file.path);
25-
var template = data === false ? headerText : lodashTemplate(headerText)(Object.assign({}, file.data || {}, { file: file, filename: filename }, data));
25+
var template =
26+
data === false
27+
? headerText
28+
: lodashTemplate(headerText)(
29+
Object.assign({}, file.data || {}, { file: file, filename: filename }, data)
30+
);
2631

2732
if (file && typeof file === 'string') {
2833
this.push(template + file);
@@ -38,7 +43,7 @@ module.exports = function (headerText, data) {
3843
// handle file stream;
3944
if (file.isStream()) {
4045
var stream = through();
41-
stream.write(new Buffer(template));
46+
stream.write(Buffer.from(template));
4247
stream.on('error', this.emit.bind(this, 'error'));
4348
file.contents = file.contents.pipe(stream);
4449
this.push(file);
@@ -49,7 +54,7 @@ module.exports = function (headerText, data) {
4954
var concat = new Concat(true, filename);
5055

5156
// add template
52-
concat.add(null, new Buffer(template));
57+
concat.add(null, Buffer.from(template));
5358

5459
// add sourcemap
5560
concat.add(file.relative, file.contents, file.sourceMap);
@@ -75,8 +80,8 @@ module.exports = function (headerText, data) {
7580
};
7681

7782
/**
78-
* is stream?
79-
*/
83+
* is stream?
84+
*/
8085
function isStream(obj) {
8186
return obj instanceof stream.Stream;
8287
}
@@ -91,6 +96,6 @@ function isExistingFile(file) {
9196
if (file.isStream()) return true;
9297
if (file.isBuffer()) return true;
9398
if (typeof file.contents === 'string') return true;
94-
} catch(err) {}
99+
} catch (err) {}
95100
return false;
96101
}

0 commit comments

Comments
 (0)