forked from andyburke/autonomous.contact
refactor: finish UX refactor and move events storage
This commit is contained in:
parent
4347d20263
commit
f760156651
10 changed files with 269 additions and 27 deletions
24
public/js/external/fuzzysearch.js
vendored
Normal file
24
public/js/external/fuzzysearch.js
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
|
||||
function fuzzysearch(needle, haystack) {
|
||||
var hlen = haystack.length;
|
||||
var nlen = needle.length;
|
||||
if (nlen > hlen) {
|
||||
return false;
|
||||
}
|
||||
if (nlen === hlen) {
|
||||
return needle === haystack;
|
||||
}
|
||||
outer: for (var i = 0, j = 0; i < nlen; i++) {
|
||||
var nch = needle.charCodeAt(i);
|
||||
while (j < hlen) {
|
||||
if (haystack.charCodeAt(j++) === nch) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = fuzzysearch;
|
||||
Loading…
Add table
Add a link
Reference in a new issue