Fix bufferify input normalization. #35

This commit is contained in:
Miguel Mota 2021-03-29 15:47:37 -07:00
parent 6f50a49475
commit 137aacb040
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "merkletreejs",
"version": "0.2.14",
"version": "0.2.15",
"description": "Construct Merkle Trees and verify proofs",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1077,14 +1077,14 @@ export class MerkleTree {
*```
*/
private _bufferifyFn (f: any):any {
return function (value: any) {
return (value: any) => {
const v = f(value)
if (Buffer.isBuffer(v)) {
return v
}
if (this._isHexString(v)) {
return Buffer.from(v, 'hex')
return Buffer.from(v.replace('0x', ''), 'hex')
}
// crypto-js support