bevacqua / fuzzysearch

:crystal_ball: Tiny and blazing-fast fuzzy search in JavaScript
https://ponyfoo.com
MIT License
2.71k stars 87 forks source link

Circuit breaker improvement #8

Closed jayrhynas closed 9 years ago

jayrhynas commented 9 years ago

You can return a little earlier when there is no match by replacing the second breaker with:

if (qlen === tlen) {
   return query === text;
}

Since if the lengths are equal but the query does not equal the text, there is no way the query will match the text.

bevacqua commented 9 years ago

Nice one. Care to create a pull request?