Skip to content

Commit 433ee51

Browse files
ChALkeRunclechu
authored andcommitted
Avoid using deprecated Buffer API
Use Buffer.alloc when it's available instead of 'new Bufer(number)' Refs: https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
1 parent 9d71360 commit 433ee51

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/deep-extend.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ function isSpecificValue(val) {
3737

3838
function cloneSpecificValue(val) {
3939
if (val instanceof Buffer) {
40-
var x = new Buffer(val.length);
40+
var x = Buffer.alloc
41+
? Buffer.alloc(val.length)
42+
: new Buffer(val.length);
4143
val.copy(x);
4244
return x;
4345
} else if (val instanceof Date) {

0 commit comments

Comments
 (0)