Update fuse.js

Fix to allow null or undefined options. The previous version had a check when setting this.options but left the variable untouched, so when trying to access eg `options.location` it through a type error.
This commit is contained in:
Chao 2014-04-09 17:56:34 +01:00
parent 7d1a7893e6
commit 887c37b669

View File

@ -36,7 +36,8 @@
* you may not use this file except in compliance with the License.
*/
var BitapSearcher = function(pattern, options) {
this.options = options || {};
options = options || {};
this.options = options;
this.options.location = options.location || BitapSearcher.defaultOptions.location;
this.options.distance = 'distance' in options ? options.distance : BitapSearcher.defaultOptions.distance;
this.options.threshold = 'threshold' in options ? options.threshold : BitapSearcher.defaultOptions.threshold;
@ -417,4 +418,4 @@
global.Fuse = Fuse;
}
})(this);
})(this);