diff options
author | iancoleman <coleman.ian@gmail.com> | 2017-01-04 10:41:15 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 10:41:15 +1100 |
commit | fef188cd1ed85b78e5f78d71e9c71f14e9e26448 (patch) | |
tree | c8c9b700eeb5b966fc361363e55c9106ebf9e086 /src/js | |
parent | 434caecd96740bbec488429026830b5ad24f628a (diff) | |
parent | 3725abb540935b4b2d4cf7e31cf378e1577e0afa (diff) | |
download | BIP39-fef188cd1ed85b78e5f78d71e9c71f14e9e26448.tar.gz BIP39-fef188cd1ed85b78e5f78d71e9c71f14e9e26448.tar.zst BIP39-fef188cd1ed85b78e5f78d71e9c71f14e9e26448.zip |
Merge pull request #48 from chrisrico/master
Allow for better suggestion when a partial mnemonic word is entered
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js index 13c6178..af09606 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -3,7 +3,7 @@ | |||
3 | // mnemonics is populated as required by getLanguage | 3 | // mnemonics is populated as required by getLanguage |
4 | var mnemonics = { "english": new Mnemonic("english") }; | 4 | var mnemonics = { "english": new Mnemonic("english") }; |
5 | var mnemonic = mnemonics["english"]; | 5 | var mnemonic = mnemonics["english"]; |
6 | var seed = null | 6 | var seed = null; |
7 | var bip32RootKey = null; | 7 | var bip32RootKey = null; |
8 | var bip32ExtendedKey = null; | 8 | var bip32ExtendedKey = null; |
9 | var network = bitcoin.networks.bitcoin; | 9 | var network = bitcoin.networks.bitcoin; |
@@ -647,6 +647,8 @@ | |||
647 | var closestWord = words[0]; | 647 | var closestWord = words[0]; |
648 | for (var i=0; i<words.length; i++) { | 648 | for (var i=0; i<words.length; i++) { |
649 | var comparedTo = words[i]; | 649 | var comparedTo = words[i]; |
650 | if (comparedTo.indexOf(word) == 0) return comparedTo; | ||
651 | |||
650 | var distance = Levenshtein.get(word, comparedTo); | 652 | var distance = Levenshtein.get(word, comparedTo); |
651 | if (distance < minDistance) { | 653 | if (distance < minDistance) { |
652 | closestWord = comparedTo; | 654 | closestWord = comparedTo; |