Skip to content

Commit

Permalink
Avoid using deprecated Buffer API
Browse files Browse the repository at this point in the history
Use Buffer.alloc when it's available instead of 'new Bufer(number)'

Refs:
https://nodejs.org/api/deprecations.html#deprecations_dep0005_buffer_constructor
  • Loading branch information
ChALkeR authored and unclechu committed Apr 28, 2018
1 parent 9d71360 commit 433ee51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/deep-extend.js
Expand Up @@ -37,7 +37,9 @@ function isSpecificValue(val) {

function cloneSpecificValue(val) {
if (val instanceof Buffer) {
var x = new Buffer(val.length);
var x = Buffer.alloc
? Buffer.alloc(val.length)
: new Buffer(val.length);
val.copy(x);
return x;
} else if (val instanceof Date) {
Expand Down

0 comments on commit 433ee51

Please sign in to comment.