2017-06-08_509bba0/509bba0_unpacked_with_node_modules/~/fuzzysearch/index.js
2022-07-26 10:06:20 -07:00

32 lines
No EOL
586 B
JavaScript
Executable file

'use strict';
function fuzzysearch (needle, haystack) {
var tlen = haystack.length;
var qlen = needle.length;
if (qlen > tlen) {
return false;
}
if (qlen === tlen) {
return needle === haystack;
}
outer: for (var i = 0, j = 0; i < qlen; i++) {
var nch = needle.charCodeAt(i);
while (j < tlen) {
if (haystack.charCodeAt(j++) === nch) {
continue outer;
}
}
return false;
}
return true;
}
module.exports = fuzzysearch;
//////////////////
// WEBPACK FOOTER
// ./~/fuzzysearch/index.js
// module id = 252
// module chunks = 4