Skip to content

Commit aaadec7

Browse files
committed
add fuzzbunny to compare
1 parent e3753c1 commit aaadec7

File tree

2 files changed

+394
-0
lines changed

2 files changed

+394
-0
lines changed

demos/compare.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,27 @@
12791279
search: null,
12801280
toStr: null,
12811281
},
1282+
{
1283+
name: 'fuzzbunny',
1284+
script: './lib/fuzzbunny.iife.js',
1285+
fulltext: false,
1286+
repo: 'https://github.com/mixpanel/fuzzbunny',
1287+
opts: {},
1288+
setup: (haystack, opts) => {
1289+
const items = haystack.map(s => ({s}));
1290+
const opts2 = {fields: [`s`]};
1291+
1292+
return {
1293+
search: needle => {
1294+
const results = fuzzbunny.fuzzyFilter(items, needle, opts2);
1295+
return results;
1296+
},
1297+
toStr: m => `<i>${+m.score.toFixed(2)}</i> ` + m.highlights.s.map((p, i) => i % 2 == 0 ? p : `<mark>${p}</mark>`).join(''),
1298+
};
1299+
},
1300+
search: null,
1301+
toStr: null,
1302+
},
12821303
// TODO:
12831304
// https://github.com/wouterrutgers/fuzzy-search (186)
12841305
// https://github.com/gjuchault/fuzzyjs (177)

0 commit comments

Comments
 (0)