mirror of https://github.com/status-im/bip39.git
index: use every not reduce
This commit is contained in:
parent
f3b4f8cc35
commit
6488b6362e
7
index.js
7
index.js
|
@ -41,9 +41,10 @@ BIP39.prototype.validate = function(mnemonic) {
|
|||
if (mnemonic.length % 3 !== 0) return false
|
||||
|
||||
var wordlist = this.wordlist
|
||||
var belongToList = mnemonic.reduce(function(memo, m) {
|
||||
return memo && (wordlist.indexOf(m) > -1)
|
||||
}, true)
|
||||
|
||||
var belongToList = mnemonic.every(function(word) {
|
||||
return wordlist.indexOf(word) > -1
|
||||
})
|
||||
|
||||
if (!belongToList) return false
|
||||
|
||||
|
|
Loading…
Reference in New Issue