Using parseInt instead of + in path parsing
+ can cause issues - +"" is 0. parseInt("", 10) is NaN, which is better (since it causes typeforce to throw).
This commit is contained in:
parent
755eac5bbd
commit
182698f53d
1 changed files with 2 additions and 2 deletions
|
@ -306,10 +306,10 @@ HDNode.prototype.derivePath = function (path) {
|
||||||
return splitPath.reduce(function (prevHd, indexStr) {
|
return splitPath.reduce(function (prevHd, indexStr) {
|
||||||
var index
|
var index
|
||||||
if (indexStr.slice(-1) === "'") {
|
if (indexStr.slice(-1) === "'") {
|
||||||
index = +(indexStr.slice(0, -1))
|
index = parseInt(indexStr.slice(0, -1), 10)
|
||||||
return prevHd.deriveHardened(index)
|
return prevHd.deriveHardened(index)
|
||||||
} else {
|
} else {
|
||||||
index = +indexStr
|
index = parseInt(indexStr, 10)
|
||||||
return prevHd.derive(index)
|
return prevHd.derive(index)
|
||||||
}
|
}
|
||||||
}, this)
|
}, this)
|
||||||
|
|
Loading…
Reference in a new issue