Package Exports
- fuzzysort
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fuzzysort) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fuzzysort
Fast SublimeText-like fuzzy search for JavaScript.
Demo
https://rawgit.com/farzher/fuzzysort/master/test.html



Installation Node
npm i fuzzysort
node
> require('fuzzysort').single('t', 'test')
{ score: 0.003, highlighted: '<b>t</b>est' }Installation Browser
<script src="fuzzysort.js"></script>Usage
fuzzysort.single(search, target)
fuzzysort.single('query', 'some string that contains my query.')
// {score: 0.059, highlighted: "some string that contains my <b>query</b>."}
fuzzysort.single('query', 'irrelevant string') // null
// exact match returns a score of 0. lower score is better
fuzzysort.single('query', 'query') // {score: 0, highlighted: "<b>query</b>"}fuzzysort.go(search, targets)
fuzzysort.go('mr', ['Monitor.cpp', 'MeshRenderer.cpp'])
// [{score: 0.018, highlighted: "<b>M</b>esh<b>R</b>enderer.cpp"}
// ,{score: 6.009, highlighted: "<b>M</b>onito<b>r</b>.cpp"}]fuzzysort.goAsync(search, targets)
let promise = fuzzysort.goAsync('mr', ['Monitor.cpp', 'MeshRenderer.cpp'])
promise.then(results => console.log(results))
if(invalidated) promise.cancel()Options
fuzzysort.noMatchLimit = 100If there's no match for a span this long, give upfuzzysort.highlightMatches = trueTurn this off if you don't care abouthighlightedfuzzysort.highlightOpen = '<b>'fuzzysort.highlightClose = '</b>'fuzzysort.limit = nullDon't return more results than this (improve performance by not highlighting everything)