Fixed issue with one word matching multiple

This commit is contained in:
Konstantin Mamalakis 2018-03-12 02:05:36 +02:00 committed by Josh Harvey
parent 3e80cb745b
commit 3722ab2af3
2 changed files with 19 additions and 3 deletions

View file

@ -55,7 +55,10 @@ function match (nameParts, birthDateString, threshold) {
const words = nameUtils.makeWords(fullName)
const wordValues = _.map(_.get('value'), words)
const wordPhonetics = _.flatMap(_.get('phonetics'), words)
const wordPhonetics = _.flatMap(word => {
const {phonetics} = word
return _.map(phonetic => ({word: word.value, phonetic}), phonetics)
}, words)
// birthDateString is in YYYYMMDD format
const birthDate = _.cond([