Replaced isEqual for better performance

This commit is contained in:
Konstantin Mamalakis 2018-03-06 23:28:08 +02:00 committed by Josh Harvey
parent 051dac127b
commit f8ec2be6e8
2 changed files with 4 additions and 5 deletions

View file

@ -39,7 +39,6 @@ function match (structs, candidate, threshold) {
const aliases = _.flatMap(_.get('aliases'), structs.individuals)
const aliasIdsFromFullName = _.flow(
_.filter(doesNameMatch),
_.map(_.get('id'))
)(aliases)
@ -53,7 +52,7 @@ function match (structs, candidate, threshold) {
// Gether aliases whose name-parts match alphabetically.
const getStringMatches = value => {
const entryMatches = entry => (jaroWinkler(value, entry.value) >= threshold)
const entryMatches = entry => (stringSimilarity(value, entry.value) >= threshold)
return _.filter(entryMatches, structs.wordList)
}
const getSingleEntries = wordEntry => {
@ -71,7 +70,7 @@ function match (structs, candidate, threshold) {
return count >= Math.min(2, alias.words.length)
}
const aliasIdsFromNamePart = _.flow(
_.uniqWith(_.isEqual),
_.uniqWith((a, b) => a.value === b.value && a.aliasId === b.aliasId),
_.map(_.get('aliasId')),
_.countBy(_.identity),
_.toPairs,