Handle case where params.fuseOpts is not defined
resulting into `Cannot read properties of null (reading 'limit')`
This commit is contained in:
parent
e71444b776
commit
d609e5d29b
@ -77,7 +77,12 @@ sInput.onkeyup = function (e) {
|
|||||||
// run a search query (for "term") every time a letter is typed
|
// run a search query (for "term") every time a letter is typed
|
||||||
// in the search box
|
// in the search box
|
||||||
if (fuse) {
|
if (fuse) {
|
||||||
const results = fuse.search(this.value.trim(), {limit: params.fuseOpts.limit}); // the actual query being run using fuse.js
|
let results;
|
||||||
|
if (params.fuseOpts) {
|
||||||
|
results = fuse.search(this.value.trim(), {limit: params.fuseOpts.limit}); // the actual query being run using fuse.js along with options
|
||||||
|
} else {
|
||||||
|
results = fuse.search(this.value.trim()); // the actual query being run using fuse.js
|
||||||
|
}
|
||||||
if (results.length !== 0) {
|
if (results.length !== 0) {
|
||||||
// build our html if result exists
|
// build our html if result exists
|
||||||
let resultSet = ''; // our results bucket
|
let resultSet = ''; // our results bucket
|
||||||
|
Loading…
x
Reference in New Issue
Block a user