0.0.11 • Published 7 years ago

@aalin/fuzzysearch v0.0.11

Weekly downloads
11
License
BSD-2-Clause
Repository
github
Last release
7 years ago

@aalin/fuzzysearch

Clever and fast async fuzzy searcher.

After looking for a good fuzzy matcher, and I couldn't find one, I decided to write my own.

Install:

npm install --save @aalin/fuzzysearch

Usage:

import Fuzzysearch from '@aalin/fuzzysearch';

const fuzzysearch = new Fuzzysearch([
  'xfxoxo',
  'foo Foo bar',
  'fasdasdo',
  'bfoo foo bar',
  'xFxOxO',
  'foo foo bar',
  'xfxOxO',
  'bfooFoo bar',
]);

fuzzysearch.search('Foo')
  .then((results) => {
    console.log(results);
  });

// Outputs:

[
  { string: 'foo Foo bar',  indexes: [ 4, 5, 6 ], score: 54, index: 1 },
  { string: 'foo foo bar',  indexes: [ 0, 1, 2 ], score: 51, index: 5 },
  { string: 'bfoo foo bar', indexes: [ 5, 6, 7 ], score: 45, index: 3 },
  { string: 'bfooFoo bar',  indexes: [ 4, 5, 6 ], score: 42, index: 7 },
  { string: 'xfxoxo',       indexes: [ 1, 3, 5 ], score:  9, index: 0 },
  { string: 'xFxOxO',       indexes: [ 1, 3, 5 ], score:  6, index: 4 },
  { string: 'xfxOxO',       indexes: [ 1, 3, 5 ], score:  3, index: 6 }
]

Matching is case insensitive but exact casing is ranked higher. Consecutive matches are ranked higher. Characters in beginning of words are ranked higher.

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago