index: use every not reduce

This commit is contained in:
Daniel Cousens 2014-06-23 13:36:49 +10:00
parent f3b4f8cc35
commit 6488b6362e

View File

@ -41,9 +41,10 @@ BIP39.prototype.validate = function(mnemonic) {
if (mnemonic.length % 3 !== 0) return false if (mnemonic.length % 3 !== 0) return false
var wordlist = this.wordlist var wordlist = this.wordlist
var belongToList = mnemonic.reduce(function(memo, m) {
return memo && (wordlist.indexOf(m) > -1) var belongToList = mnemonic.every(function(word) {
}, true) return wordlist.indexOf(word) > -1
})
if (!belongToList) return false if (!belongToList) return false