Fix Node.js 10 deprecation warnings

This commit is contained in:
David Stephens 2018-04-28 13:59:07 +01:00
parent 476e8f2f0c
commit f16eb6f3e6
12 changed files with 42 additions and 41 deletions

View file

@ -19,7 +19,7 @@ module.exports = class FNV1a {
}
if(_.isString(data)) {
data = new Buffer(data);
data = Buffer.from(data);
}
if(!Buffer.isBuffer(data)) {
@ -38,7 +38,7 @@ module.exports = class FNV1a {
digest(encoding) {
encoding = encoding || 'binary';
let buf = new Buffer(4);
let buf = Buffer.alloc(4);
buf.writeInt32BE(this.hash & 0xffffffff, 0);
return buf.toString(encoding);
}