Fix bufferify input normalization. #35
This commit is contained in:
parent
6f50a49475
commit
137aacb040
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "merkletreejs",
|
"name": "merkletreejs",
|
||||||
"version": "0.2.14",
|
"version": "0.2.15",
|
||||||
"description": "Construct Merkle Trees and verify proofs",
|
"description": "Construct Merkle Trees and verify proofs",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|
|
@ -1077,14 +1077,14 @@ export class MerkleTree {
|
||||||
*```
|
*```
|
||||||
*/
|
*/
|
||||||
private _bufferifyFn (f: any):any {
|
private _bufferifyFn (f: any):any {
|
||||||
return function (value: any) {
|
return (value: any) => {
|
||||||
const v = f(value)
|
const v = f(value)
|
||||||
if (Buffer.isBuffer(v)) {
|
if (Buffer.isBuffer(v)) {
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._isHexString(v)) {
|
if (this._isHexString(v)) {
|
||||||
return Buffer.from(v, 'hex')
|
return Buffer.from(v.replace('0x', ''), 'hex')
|
||||||
}
|
}
|
||||||
|
|
||||||
// crypto-js support
|
// crypto-js support
|
||||||
|
|
Loading…
Reference in New Issue