Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Commit

Permalink
Support BN.isBN in toBuffer()
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Mar 15, 2016
1 parent fd01e54 commit 13ce738
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ exports.toBuffer = function (v) {
v = exports.intToBuffer(v)
} else if (v === null || v === undefined) {
v = new Buffer([])
} else if (BN.isBN(v)) {
v = v.toBuffer()
} else if (v.toArray) {
// converts a BN to a Buffer
v = new Buffer(v.toArray())
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"homepage": "https://github.com/ethereumjs/ethereumjs-util",
"dependencies": {
"bn.js": "^4.8.0",
"bn.js": "^4.11.0",
"keccakjs": "^0.1.0",
"rlp": "^2.0.0",
"secp256k1": "^3.0.1"
Expand Down

0 comments on commit 13ce738

Please sign in to comment.