## FuzzySearch()

Constructor

#### # new FuzzySearch()

fuzzy-search.jsxinc.
by Duduf and Wouter Rutgers.

Version:
  - 1.0.0
Author:
  - Nicolas Dufresne and contributors
Copyright:
  - 2022 Nicolas Dufresne, RxLaboratory
License:
  - GNU-GPLv3

View Source Duik_api_fordoc.jsxinc, line 5867

##### Example

    // Encapsulate everything to avoid global variables!
    (function() {
        #include "fuzzy-search.jsxinc"

        var people = [{
        name: {
            firstName: 'Jesse',
            lastName: 'Bowen',
        },
       state: 'Seattle',
        }];

        var searcher = new FuzzySearch(people, ['name.firstName', 'state'], {
            caseSensitive: true,
        });
        var result = searcher.search('ess');
    })();

# Methods

#### # static match(item, query, caseSensitiveopt) → {float}

Caculates the score of a string against a query

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`item` | `string` |  |  | The string to test
`query` | `string` |  |  | The string to search
`caseSensitive` | `bool` | <optional> | false | Whether to check the case or not

View Source Duik_api_fordoc.jsxinc, line 5961

Returns:
The score, a positive value.
- `0`: no match
- `1`: perfect match
- `>1`: the lower the score, the better the match
Type: `float`

#### # search(query) → {Array.<Obbject>}

Searches for items in the haystack

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` | `string` | The string to search

View Source Duik_api_fordoc.jsxinc, line 5891

Returns:
The matching results. Objects with two attributes: `item` and `score`.
Type: `Array.<Obbject>`