question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What are the default values for options object?

See original GitHub issue

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)
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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kriskcommented, Mar 15, 2020

@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.

2reactions
MetalCarcommented, Feb 4, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found