What are the default values for options object?
See original GitHub issueFrom 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) |
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
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to correctly specify default options in ES6 - Mixmax
Default parameters are an awesome ES6 feature. However, the ability to specify objects as default values is a clear footgun. You should always ......
Read more >A javascript design pattern for options with default values?
This way you only define one options object inside the function, which contains the default values. If you want to put an extra...
Read more >Default parameters - JavaScript - MDN Web Docs
Default function parameters allow named parameters to be initialized with default values if no value or undefined is passed.
Read more >Understanding Default Parameters in JavaScript - DigitalOcean
Default Parameter Data Types ... Any primitive value or object can be used as a default parameter value. In this section, you will...
Read more >The Beginner's Guide to JavaScript Default Parameters
In JavaScript, default function parameters allow you to initialize named parameters with default values if no values or undefined are passed into the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@whyboris instead of a separate table, I think it’d be good to simply have the defaults inline with the option name. I’m going to be updating these this week as I’m already pushing subsequent versions.
Can confirm that the default value for
shouldSort
istrue
. Please update it in the documentation @krisk 😃