Skip to content

Commit 4b92f3f

Browse files
authored
Fix deprecated Buffer (#174)
1 parent 8d47008 commit 4b92f3f

2 files changed

Lines changed: 23 additions & 23 deletions

File tree

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function templateCacheFiles(root, base, templateBody, transformUrl, escapeOption
9090
* Create buffer
9191
*/
9292

93-
file.contents = new Buffer(lodashTemplate(template)({
93+
file.contents = Buffer.from(lodashTemplate(template)({
9494
url: url,
9595
contents: jsesc(file.contents.toString('utf8'), escapeOptions),
9696
file: file

test/test.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ describe('gulp-angular-templatecache', function () {
1919
stream.write(new Vinyl({
2020
base: __dirname,
2121
path: __dirname + '/template-a.html',
22-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
22+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
2323
}));
2424

2525
stream.write(new Vinyl({
2626
base: __dirname,
2727
path: __dirname + '/template-b.html',
28-
contents: new Buffer('<h1 id="template-b">I\'m template B!</h1>')
28+
contents: Buffer.from('<h1 id="template-b">I\'m template B!</h1>')
2929
}));
3030

3131
stream.end();
@@ -47,7 +47,7 @@ describe('gulp-angular-templatecache', function () {
4747
stream.write(new Vinyl({
4848
base: __dirname,
4949
path: __dirname + '/template-a.html',
50-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
50+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
5151
}));
5252

5353
stream.end();
@@ -75,7 +75,7 @@ describe('gulp-angular-templatecache', function () {
7575
stream.write(new Vinyl({
7676
base: __dirname,
7777
path: __dirname + '/directory/template-a.html',
78-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
78+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
7979
}));
8080

8181
stream.end();
@@ -99,7 +99,7 @@ describe('gulp-angular-templatecache', function () {
9999
stream.write(new Vinyl({
100100
base: __dirname,
101101
path: __dirname + '/template-a.html',
102-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
102+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
103103
}));
104104

105105
stream.end();
@@ -120,7 +120,7 @@ describe('gulp-angular-templatecache', function () {
120120
stream.write(new Vinyl({
121121
base: __dirname,
122122
path: __dirname + '/template-a.html',
123-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
123+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
124124
}));
125125

126126
stream.end();
@@ -141,7 +141,7 @@ describe('gulp-angular-templatecache', function () {
141141
stream.write(new Vinyl({
142142
base: __dirname,
143143
path: __dirname + '/template-a.html',
144-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
144+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
145145
}));
146146

147147
stream.end();
@@ -162,7 +162,7 @@ describe('gulp-angular-templatecache', function () {
162162
stream.write(new Vinyl({
163163
base: __dirname,
164164
path: __dirname + '/template-a.html',
165-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
165+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
166166
}));
167167

168168
stream.end();
@@ -190,7 +190,7 @@ describe('gulp-angular-templatecache', function () {
190190
stream.write(new Vinyl({
191191
base: __dirname,
192192
path: __dirname + '/template-a.html',
193-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
193+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
194194
}));
195195

196196
stream.end();
@@ -214,7 +214,7 @@ describe('gulp-angular-templatecache', function () {
214214
stream.write(new Vinyl({
215215
base: __dirname,
216216
path: __dirname + '/template-a.html',
217-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
217+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
218218
}));
219219

220220
stream.end();
@@ -240,7 +240,7 @@ describe('gulp-angular-templatecache', function () {
240240
stream.write(new Vinyl({
241241
base: __dirname,
242242
path: __dirname + '/template-a.html',
243-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
243+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
244244
}));
245245

246246
stream.end();
@@ -263,7 +263,7 @@ describe('gulp-angular-templatecache', function () {
263263
stream.write(new Vinyl({
264264
base: __dirname,
265265
path: __dirname + '/template-a.html',
266-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
266+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
267267
}));
268268

269269
stream.end();
@@ -286,7 +286,7 @@ describe('gulp-angular-templatecache', function () {
286286
stream.write(new Vinyl({
287287
base: __dirname,
288288
path: __dirname + '/template-a.html',
289-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
289+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
290290
}));
291291

292292
stream.end();
@@ -314,7 +314,7 @@ describe('gulp-angular-templatecache', function () {
314314
stream.write(new Vinyl({
315315
base: __dirname,
316316
path: __dirname + '/template-a.html',
317-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
317+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
318318
}));
319319

320320
stream.end();
@@ -339,7 +339,7 @@ describe('gulp-angular-templatecache', function () {
339339
stream.write(new Vinyl({
340340
base: __dirname,
341341
path: __dirname + '/template-a.html',
342-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
342+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
343343
}));
344344

345345
stream.end();
@@ -366,7 +366,7 @@ describe('gulp-angular-templatecache', function () {
366366
stream.write(new Vinyl({
367367
base: __dirname,
368368
path: __dirname + '/template-a.html',
369-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
369+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
370370
}));
371371

372372
stream.end();
@@ -387,7 +387,7 @@ describe('gulp-angular-templatecache', function () {
387387
stream.write(new Vinyl({
388388
base: __dirname,
389389
path: __dirname + '/template-a.html',
390-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
390+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
391391
}));
392392

393393
stream.end();
@@ -408,7 +408,7 @@ describe('gulp-angular-templatecache', function () {
408408
stream.write(new Vinyl({
409409
base: __dirname,
410410
path: __dirname + '/template-a.html',
411-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
411+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
412412
}));
413413

414414
stream.end();
@@ -429,7 +429,7 @@ describe('gulp-angular-templatecache', function () {
429429
stream.write(new Vinyl({
430430
base: __dirname,
431431
path: __dirname + '/template-a.html',
432-
contents: new Buffer('<h1 id="template-a">I\'m template A!</h1>')
432+
contents: Buffer.from('<h1 id="template-a">I\'m template A!</h1>')
433433
}));
434434

435435
stream.end();
@@ -455,7 +455,7 @@ describe('gulp-angular-templatecache', function () {
455455
stream.write(new Vinyl({
456456
base: __dirname,
457457
path: __dirname + '/template-a.html',
458-
contents: new Buffer('yoo')
458+
contents: Buffer.from('yoo')
459459
}));
460460

461461
stream.end();
@@ -477,7 +477,7 @@ describe('gulp-angular-templatecache', function () {
477477
stream.write(new Vinyl({
478478
base: __dirname,
479479
path: __dirname + '/template-a.html',
480-
contents: new Buffer('yoo')
480+
contents: Buffer.from('yoo')
481481
}));
482482

483483
stream.end();
@@ -501,7 +501,7 @@ describe('gulp-angular-templatecache', function () {
501501
stream.write(new Vinyl({
502502
base: __dirname,
503503
path: __dirname + '/template-a.html',
504-
contents: new Buffer('yoo')
504+
contents: Buffer.from('yoo')
505505
}));
506506

507507
stream.end();

0 commit comments

Comments
 (0)