diff --git a/lib/hdkey.js b/lib/hdkey.js index 04e93ba..09e07a7 100644 --- a/lib/hdkey.js +++ b/lib/hdkey.js @@ -140,10 +140,11 @@ var HDKey = ("object" === typeof module && exports) || {}; let entries = path.split("/"); let _hdkey = hdkey; - entries.forEach(function (c, i) { + for (let i = 0; i < entries.length; i += 1) { + let c = entries[i]; if (i === 0) { assert(/^[mM]{1}/.test(c), 'Path must start with "m" or "M"'); - return; + continue; } let hardened = c.length > 1 && c[c.length - 1] === "'"; @@ -154,7 +155,7 @@ var HDKey = ("object" === typeof module && exports) || {}; } _hdkey = _hdkey.deriveChild(childIndex); - }); + } return _hdkey; };