src: Replace instanceof Array checks with Array.isArray and instanceof Buffer with Buffer.isBuffer (#3227)

* src: Replace instanceof Array checks with Array.isArray

* src: Buffer.isBuffer instead of instanceof Buffer
This commit is contained in:
Vlad Frangu
2019-04-29 19:49:41 +03:00
committed by Amish Shah
parent 9b0f4b298d
commit d7a9b74523
11 changed files with 26 additions and 25 deletions

View File

@@ -22,7 +22,7 @@ exports.pack = erlpack ? erlpack.pack : JSON.stringify;
exports.unpack = data => {
if (!erlpack || data[0] === '{') return JSON.parse(data);
if (!(data instanceof Buffer)) data = Buffer.from(new Uint8Array(data));
if (!Buffer.isBuffer(data)) data = Buffer.from(new Uint8Array(data));
return erlpack.unpack(data);
};