Use Buffer.from()

This commit is contained in:
Elliot Lee
2019-09-03 11:03:54 -07:00
parent 558710978f
commit 86d485869a
5 changed files with 7 additions and 7 deletions

View File

@@ -14,7 +14,7 @@
},
"scripts": {
"compile": "tsc",
"test": "tsc && mocha",
"test": "tsc && tslint -p ./ && mocha",
"lint": "tslint -p ./"
},
"devDependencies": {

View File

@@ -22,7 +22,7 @@ function isSequence(val) {
* a single element or a sequence, which has a `length` property and supports
* element retrieval via sequence[ix].
*
* > concatArgs(1, [2, 3], new Buffer([4,5]), new Uint8Array([6, 7]));
* > concatArgs(1, [2, 3], Buffer.from([4,5]), new Uint8Array([6, 7]));
* [1,2,3,4,5,6,7]
*
* @return {Array} - concatenated arguments

View File

@@ -2,11 +2,11 @@ const assert = require('assert')
const api = require('../dist')
function toHex(bytes) {
return new Buffer(bytes).toString('hex').toUpperCase()
return Buffer.from(bytes).toString('hex').toUpperCase()
}
function toBytes(hex) {
return new Buffer(hex, 'hex').toJSON().data
return Buffer.from(hex, 'hex').toJSON().data
}
describe('ripple-address-codec', function() {

View File

@@ -2,11 +2,11 @@ const assert = require('assert')
const api = require('../dist/xrp-codec')
function toHex(bytes) {
return new Buffer(bytes).toString('hex').toUpperCase()
return Buffer.from(bytes).toString('hex').toUpperCase()
}
function toBytes(hex) {
return new Buffer(hex, 'hex').toJSON().data
return Buffer.from(hex, 'hex').toJSON().data
}
describe('ripple-address-codec', function() {

View File

@@ -17,7 +17,7 @@
"suppressImplicitAnyIndexErrors": false,
"sourceMap": true,
"skipLibCheck": true,
"allowJs": true
"declaration": true
},
"include": [
"src/**/*.ts"