diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-01-04 10:59:21 +1100 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-01-04 10:59:21 +1100 |
commit | 6ea15134a4ff5a443d96de5882bcddbe7300fc6f (patch) | |
tree | c3e0caab1508d330eb5c2a3e5bf4cedd8d2048d9 /src/js | |
parent | fef188cd1ed85b78e5f78d71e9c71f14e9e26448 (diff) | |
download | BIP39-6ea15134a4ff5a443d96de5882bcddbe7300fc6f.tar.gz BIP39-6ea15134a4ff5a443d96de5882bcddbe7300fc6f.tar.zst BIP39-6ea15134a4ff5a443d96de5882bcddbe7300fc6f.zip |
Test suggested word for first four letters of word
See https://github.com/iancoleman/bip39/pull/48
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/index.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/js/index.js b/src/js/index.js index af09606..c198977 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -647,8 +647,9 @@ | |||
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; | 650 | if (comparedTo.indexOf(word) == 0) { |
651 | 651 | return comparedTo; | |
652 | } | ||
652 | var distance = Levenshtein.get(word, comparedTo); | 653 | var distance = Levenshtein.get(word, comparedTo); |
653 | if (distance < minDistance) { | 654 | if (distance < minDistance) { |
654 | closestWord = comparedTo; | 655 | closestWord = comparedTo; |