Skip to content

Commit

Permalink
Gi60s#78 Change from Buffer constructors to Buffer.from()
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Rosebury committed May 21, 2020
1 parent e36c996 commit 3b63328
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,5 @@ crashlytics.properties
crashlytics-build.properties
fabric.properties

# VS Code
.history
4 changes: 2 additions & 2 deletions src/data-type-formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports.binary = {
const length = value.length;
const array = [];
for (let i = 0; i < length; i += 8) array.push(parseInt(value.substr(i, 8), 2))
return Buffer.from ? Buffer.from(array, 'binary') : new Buffer(array, 'binary');
return Buffer.from(array, 'binary');
}
},

Expand Down Expand Up @@ -81,7 +81,7 @@ exports.byte = {
if (!rx.byte.test(value) || value.length % 4 !== 0) {
exception.message('Expected a base64 string');
} else {
return Buffer.from ? Buffer.from(value, 'base64') : new Buffer(value, 'base64');
return Buffer.from(value, 'base64');
}
} else {
exception.message('Expected a base64 string');
Expand Down

0 comments on commit 3b63328

Please sign in to comment.