Fuse: What are the default values for options object?

Created on 19 Jan 2020  路  7Comments  路  Source: krisk/Fuse

From reading the documentation it's not at all clear what the defaults are for the library if you do not provide them.

Could we get a clear list?

From the _code_ it looks like we have these:

| property | default |
| -------- | ------- |
| location | 0 |
| distance | 100 |
| threshold | 0.6 |
| maxPatternLength | 32 |
| caseSensitive | false |
| tokenSeparator | / +/g |
| findAllMatches | false |
| minMatchCharLength | 1 |
| id | null |
| keys | [] |
| shouldSort | true |
| getFn | deepValue |
| sortFn | (a, b) |> (a.score - b.score) |
| tokenize | false |
| matchAllTokens | false |
| includeMatches | false |
| includeScore | false |
| verbose | false |

location = 0,
distance = 100,
threshold = 0.6,
maxPatternLength = 32,
caseSensitive = false,
tokenSeparator = / +/g,
findAllMatches = false,
minMatchCharLength = 1,
id = null,
keys = [],
shouldSort = true,
getFn = deepValue,
sortFn = (a, b) => (a.score - b.score),
tokenize = false,
matchAllTokens = false,
includeMatches = false,
includeScore = false,
verbose = false

Ref: https://github.com/krisk/Fuse/blob/master/src/index.js#L7

Would a PR for gh-pages branch be welcome _and_ merged in if I make one?
https://github.com/krisk/Fuse/blob/gh-pages/index.html#L376

Stale question

Most helpful comment

@whyboris instead of a separate table, I think it鈥檇 be good to simply have the defaults inline with the option name. I鈥檓 going to be updating these this week as I鈥檓 already pushing subsequent versions.

All 7 comments

@krisk - I'm happy to create a PR, but don't want to spend time unless it's likely to be merged in.

If you think having a nice table / chart of default values would be an improvement, please comment where you'd like it to live, on gh-pages or README.md or elsewhere 馃

Can confirm that the default value for shouldSort is true. Please update it in the documentation @krisk :)

deepValue => get in the latest version

Would a PR that includes this table of defaults to be merged into the gh-pages branch be welcome and merged in if I make one?

@whyboris instead of a separate table, I think it鈥檇 be good to simply have the defaults inline with the option name. I鈥檓 going to be updating these this week as I鈥檓 already pushing subsequent versions.

I wonder if, given that there are so many options now, it would also make sense to alphabetize them (for ease of finding) 馃

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Was this page helpful?
0 / 5 - 0 ratings