mirror of
				https://github.com/Wonderfall/hugo-WonderMod.git
				synced 2025-10-30 19:35:26 +01:00 
			
		
		
		
	Fix params.fuseOpts being ignored by Fuse.js
				
					
				
			by implementing a map of lower case to camel case parameters fixes: #556
This commit is contained in:
		| @@ -26,7 +26,21 @@ window.onload = function () { | |||||||
|                             'content' |                             'content' | ||||||
|                         ] |                         ] | ||||||
|                     }; |                     }; | ||||||
|                     if (params.fuseOpts) options = params.fuseOpts; |                     if (params.fuseOpts) { | ||||||
|  |                         options = { | ||||||
|  |                             isCaseSensitive: params.fuseOpts.iscasesensitive ? params.fuseOpts.iscasesensitive : false, | ||||||
|  |                             includeScore: params.fuseOpts.includescore ? params.fuseOpts.includescore : false, | ||||||
|  |                             includeMatches: params.fuseOpts.includematches ? params.fuseOpts.includematches : false, | ||||||
|  |                             minMatchCharLength: params.fuseOpts.minmatchcharlength ? params.fuseOpts.minmatchcharlength : 1, | ||||||
|  |                             shouldSort: params.fuseOpts.shouldsort ? params.fuseOpts.shouldsort : true, | ||||||
|  |                             findAllMatches: params.fuseOpts.findallmatches ? params.fuseOpts.findallmatches : false, | ||||||
|  |                             keys: params.fuseOpts.keys ? params.fuseOpts.keys : ['title', 'permalink', 'summary', 'content'], | ||||||
|  |                             location: params.fuseOpts.location ? params.fuseOpts.location : 0, | ||||||
|  |                             threshold: params.fuseOpts.threshold ? params.fuseOpts.threshold : 0.4, | ||||||
|  |                             distance: params.fuseOpts.distance ? params.fuseOpts.distance : 100, | ||||||
|  |                             ignoreLocation: params.fuseOpts.ignorelocation ? params.fuseOpts.ignorelocation : true | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|                     fuse = new Fuse(data, options); // build the index from the json file |                     fuse = new Fuse(data, options); // build the index from the json file | ||||||
|                 } |                 } | ||||||
|             } else { |             } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aditya Telange
					Aditya Telange