1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Refactor buffer constructor (#5468)

This commit is contained in:
Noel Yoo 2018-10-09 21:02:48 +09:00 committed by Whymarrh Whitby
parent 012f7ddd72
commit ebdefe81a1
4 changed files with 4 additions and 4 deletions

View File

@ -272,6 +272,6 @@ function normalizeMsgData (data) {
return data
} else {
// data is unicode, convert to hex
return ethUtil.bufferToHex(new Buffer(data, 'utf8'))
return ethUtil.bufferToHex(Buffer.from(data, 'utf8'))
}
}

View File

@ -285,7 +285,7 @@ module.exports = class PersonalMessageManager extends EventEmitter {
log.debug(`Message was not hex encoded, interpreting as utf8.`)
}
return ethUtil.bufferToHex(new Buffer(data, 'utf8'))
return ethUtil.bufferToHex(Buffer.from(data, 'utf8'))
}
}

View File

@ -1,5 +1,5 @@
var mockHex = '0xabcdef0123456789'
var mockKey = new Buffer(32)
var mockKey = Buffer.alloc(32)
let cacheVal
module.exports = {

View File

@ -4,7 +4,7 @@ var BinaryRenderer = require('../../../old-ui/app/components/binary-renderer')
describe('BinaryRenderer', function () {
let binaryRenderer
const message = 'Hello, world!'
const buffer = new Buffer(message, 'utf8')
const buffer = Buffer.from(message, 'utf8')
const hex = buffer.toString('hex')
beforeEach(function () {