Skip to content

Commit c91b816

Browse files
MylesBorinsForbesLindesay
authored andcommitted
use new to instantiate all buffers (#75)
Using Buffer without `new` will soon stop working. It will throw A deprecation warning in Node v7.
1 parent c96715e commit c91b816

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ module.exports = function (opts) {
4444
function write (row, enc, next) {
4545
if (first && opts.standalone) {
4646
var pre = umd.prelude(opts.standalone).trim();
47-
stream.push(Buffer(pre + 'return '));
47+
stream.push(new Buffer(pre + 'return '));
4848
}
4949
else if (first && stream.hasExports) {
5050
var pre = opts.externalRequireName || 'require';
51-
stream.push(Buffer(pre + '='));
51+
stream.push(new Buffer(pre + '='));
5252
}
53-
if (first) stream.push(Buffer(prelude + '({'));
53+
if (first) stream.push(new Buffer(prelude + '({'));
5454

5555
if (row.sourceFile && !row.nomap) {
5656
if (!sourcemap) {
@@ -81,7 +81,7 @@ module.exports = function (opts) {
8181
']'
8282
].join('');
8383

84-
stream.push(Buffer(wrappedSource));
84+
stream.push(new Buffer(wrappedSource));
8585
lineno += newlinesIn(wrappedSource);
8686

8787
first = false;
@@ -93,13 +93,13 @@ module.exports = function (opts) {
9393
}
9494

9595
function end () {
96-
if (first) stream.push(Buffer(prelude + '({'));
96+
if (first) stream.push(new Buffer(prelude + '({'));
9797
entries = entries.filter(function (x) { return x !== undefined });
9898

99-
stream.push(Buffer('},{},' + JSON.stringify(entries) + ')'));
99+
stream.push(new Buffer('},{},' + JSON.stringify(entries) + ')'));
100100

101101
if (opts.standalone && !first) {
102-
stream.push(Buffer(
102+
stream.push(new Buffer(
103103
'(' + JSON.stringify(stream.standaloneModule) + ')'
104104
+ umd.postlude(opts.standalone)
105105
));
@@ -112,9 +112,9 @@ module.exports = function (opts) {
112112
/^\/\/#/, function () { return opts.sourceMapPrefix }
113113
)
114114
}
115-
stream.push(Buffer('\n' + comment + '\n'));
115+
stream.push(new Buffer('\n' + comment + '\n'));
116116
}
117-
if (!sourcemap && !opts.standalone) stream.push(Buffer(';\n'));
117+
if (!sourcemap && !opts.standalone) stream.push(new Buffer(';\n'));
118118

119119
stream.push(null);
120120
}

0 commit comments

Comments
 (0)