|
|
@ -74,7 +74,7 @@ function HDPrivateKey(arg) { |
|
|
|
HDPrivateKey.isValidPath = function(arg, hardened) { |
|
|
|
if (_.isString(arg)) { |
|
|
|
var indexes = HDPrivateKey._getDerivationIndexes(arg); |
|
|
|
return indexes !== null && _.all(indexes, HDPrivateKey.isValidPath); |
|
|
|
return indexes !== null && _.every(indexes, HDPrivateKey.isValidPath); |
|
|
|
} |
|
|
|
|
|
|
|
if (_.isNumber(arg)) { |
|
|
@ -99,11 +99,11 @@ HDPrivateKey._getDerivationIndexes = function(path) { |
|
|
|
var steps = path.split('/'); |
|
|
|
|
|
|
|
// Special cases:
|
|
|
|
if (_.contains(HDPrivateKey.RootElementAlias, path)) { |
|
|
|
if (_.includes(HDPrivateKey.RootElementAlias, path)) { |
|
|
|
return []; |
|
|
|
} |
|
|
|
|
|
|
|
if (!_.contains(HDPrivateKey.RootElementAlias, steps[0])) { |
|
|
|
if (!_.includes(HDPrivateKey.RootElementAlias, steps[0])) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
@ -123,7 +123,7 @@ HDPrivateKey._getDerivationIndexes = function(path) { |
|
|
|
return index; |
|
|
|
}); |
|
|
|
|
|
|
|
return _.any(indexes, isNaN) ? null : indexes; |
|
|
|
return _.some(indexes, isNaN) ? null : indexes; |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|