Skip to content

Commit

Permalink
perf(fuzzy): update defuzz()
Browse files Browse the repository at this point in the history
- skip preparation of rule outputs which aren't requested
  • Loading branch information
postspectacular committed Dec 10, 2020
1 parent f82c1b5 commit 60030dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/fuzzy/src/defuzz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export const defuzz = (
const weight = (acc || 0) * r.weight;
const terms: IObjectOf<FuzzyFn> = {};
for (let id in r.then) {
terms[id] = weightedTerm(outs[id].terms[r.then[id]], weight);
if (outs[id]) {
terms[id] = weightedTerm(outs[id].terms[r.then[id]], weight);
}
}
return terms;
});
Expand Down

0 comments on commit 60030dd

Please sign in to comment.