Comparing version 5.0.5-beta to 5.0.6-beta
@@ -0,1 +1,5 @@ | ||
# Version 5.0.6-beta | ||
- Fixed (#357) | ||
# Version 5.0.3-beta | ||
@@ -2,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Type definitions for Fuse.js v5.0.5-beta | ||
// Type definitions for Fuse.js v5.0.6-beta | ||
// TypeScript Version: 3.1 | ||
@@ -3,0 +3,0 @@ |
/*! | ||
* Fuse.js v5.0.5-beta - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v5.0.6-beta - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -9,2 +9,2 @@ * Copyright (c) 2012-2020 Kirollos Risk (http://kiro.me) | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Fuse",[],e):"object"==typeof exports?exports.Fuse=e():t.Fuse=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports={isDefined:function(t){return null!=t},isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:function(t){return"object"===r(t)},toString:function(t){return null==t?"":function(t){if("string"==typeof t)return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(7),o=r(10),s=r(2).MAX_BITS,a=function(){function t(e,r){var n=r.location,i=void 0===n?0:n,a=r.distance,c=void 0===a?100:a,u=r.threshold,h=void 0===u?.6:u,f=r.isCaseSensitive,l=void 0!==f&&f,v=r.findAllMatches,p=void 0!==v&&v,d=r.minMatchCharLength,y=void 0===d?1:d,g=r.includeMatches,m=void 0!==g&&g;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={location:i,distance:c,threshold:h,isCaseSensitive:l,findAllMatches:p,includeMatches:m,minMatchCharLength:y},e.length>s)throw new Error("Pattern length exceeds max of ".concat(s,"."));this.pattern=l?e:e.toLowerCase(),this.patternAlphabet=o(this.pattern)}var e,r,a;return e=t,(r=[{key:"searchIn",value:function(t){var e=t.$,r=this.options,n=r.isCaseSensitive,o=r.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var s={isMatch:!0,score:0};return o&&(s.matchedIndices=[[0,e.length-1]]),s}var a=this.options,c=a.location,u=a.distance,h=a.threshold,f=a.findAllMatches,l=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:c,distance:u,threshold:h,findAllMatches:f,minMatchCharLength:l,includeMatches:o})}}])&&n(e.prototype,r),a&&n(e,a),t}();t.exports=a},function(t,e){t.exports.MAX_BITS=32},function(t,e){t.exports=function(t,e){var r=e.n,n=void 0===r?3:r,i=e.pad,o=void 0===i||i,s=e.sort,a=void 0!==s&&s,c=[];if(null==t)return c;t=t.toLowerCase(),o&&(t=" ".concat(t," "));var u=t.length-n+1;if(u<1)return c;for(;u--;)c[u]=t.substr(u,n);return a&&c.sort((function(t,e){return t==e?0:t<e?-1:1})),c}},function(t,e,r){var n=r(0),i=n.isDefined,o=n.isString,s=n.isNumber,a=n.isArray,c=n.toString;t.exports=function(t,e){var r=[],n=!1;return function t(e,u){if(u){var h=u.indexOf("."),f=u,l=null;-1!==h&&(f=u.slice(0,h),l=u.slice(h+1));var v=e[f];if(i(v))if(l||!o(v)&&!s(v))if(a(v)){n=!0;for(var p=0,d=v.length;p<d;p+=1)t(v[p],l)}else l&&t(v,l);else r.push(c(v))}else r.push(e)}(t,e),n?r:r[0]}},function(t,e,r){function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var c=r(6),u=c.BitapSearch,h=c.ExtendedSearch,f=c.NGramSearch,l=r(0),v=l.isArray,p=l.isDefined,d=l.isString,y=l.isNumber,g=(l.isObject,r(4)),m=r(24),b=m.createIndex,x=m.KeyStore,S=r(27),k=S.transformMatches,M=S.transformScore,w=r(2).MAX_BITS,_={isCaseSensitive:!1,distance:100,findAllMatches:!1,getFn:g,includeMatches:!1,includeScore:!1,keys:[],location:0,minMatchCharLength:1,shouldSort:!0,sortFn:function(t,e){return t.score-e.score},threshold:.6,useExtendedSearch:!1},O=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s(this,t),this.options=i({},_,{},r),this.options.isCaseSensitive=r.caseSensitive,delete this.options.caseSensitive,this._processKeys(this.options.keys),this.setCollection(e,n)}var e,r,n;return e=t,(r=[{key:"setCollection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.list=t,this.listIsStringArray=d(t[0]),e?this.setIndex(e):this.setIndex(this._createIndex())}},{key:"setIndex",value:function(t){this._indexedList=t}},{key:"_processKeys",value:function(e){this._keyStore=new x(e),t.verbose}},{key:"_createIndex",value:function(){return b(this._keyStore.keys(),this.list,{getFn:this.options.getFn})}},{key:"search",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1},r=this.options,n=r.useExtendedSearch,i=r.shouldSort,o=null;o=n?new h(t,this.options):t.length>w?new f(t,this.options):new u(t,this.options);var s=this._searchUsing(o);return this._computeScore(s),i&&this._sort(s),e.limit&&y(e.limit)&&(s=s.slice(0,e.limit)),this._format(s)}},{key:"_searchUsing",value:function(t){var e=this._indexedList,r=[],n=this.options.includeMatches;if(this.listIsStringArray)for(var i=0,o=e.length;i<o;i+=1){var s=e[i],a=s.$,c=s.idx;if(p(a)){var u=t.searchIn(s),h=u.isMatch,f=u.score;if(h){var l={score:f,value:a};n&&(l.indices=u.matchedIndices),r.push({item:a,idx:c,matches:[l]})}}}else for(var d=this._keyStore.keys(),y=this._keyStore.count(),g=0,m=e.length;g<m;g+=1){var b=e[g],x=b.$,S=b.idx;if(p(x)){for(var k=[],M=0;M<y;M+=1){var w=d[M],_=x[w];if(p(_))if(v(_))for(var O=0,j=_.length;O<j;O+=1){var A=_[O],P=A.$,I=A.idx;if(p(P)){var C=t.searchIn(A),L=C.isMatch,F=C.score;if(L){var E={score:F,key:w,value:P,idx:I};n&&(E.indices=C.matchedIndices),k.push(E)}}}else{var N=_.$,$=t.searchIn(_),z=$.isMatch,D=$.score;if(!z)continue;var T={score:D,key:w,value:N};n&&(T.indices=$.matchedIndices),k.push(T)}}k.length&&r.push({idx:S,item:x,matches:k})}}return r}},{key:"_computeScore",value:function(t){for(var e=0,r=t.length;e<r;e+=1){for(var n=t[e],i=n.matches,o=i.length,s=1,a=0;a<o;a+=1){var c=i[a],u=c.key,h=this._keyStore.get(u,"weight"),f=h||1,l=0===c.score&&h&&h>0?Number.EPSILON:c.score;s*=Math.pow(l,f)}n.score=s}}},{key:"_sort",value:function(t){t.sort(this.options.sortFn)}},{key:"_format",value:function(t){var e=[],r=this.options,n=r.includeMatches,i=r.includeScore,o=[];n&&o.push(k),i&&o.push(M);for(var s=0,a=t.length;s<a;s+=1){var c=t[s],u=c.idx,h={item:this.list[u],refIndex:u};if(o.length)for(var f=0,l=o.length;f<l;f+=1)o[f](c,h);e.push(h)}return e}}])&&a(e.prototype,r),n&&a(e,n),t}();O.createIndex=b,t.exports=O},function(t,e,r){t.exports={BitapSearch:r(1),ExtendedSearch:r(11),NGramSearch:r(18)}},function(t,e,r){var n=r(8),i=r(9);t.exports=function(t,e,r,o){for(var s=o.location,a=void 0===s?0:s,c=o.distance,u=void 0===c?100:c,h=o.threshold,f=void 0===h?.6:h,l=o.findAllMatches,v=void 0!==l&&l,p=o.minMatchCharLength,d=void 0===p?1:p,y=o.includeMatches,g=void 0!==y&&y,m=e.length,b=t.length,x=Math.max(0,Math.min(a,b)),S=f,k=t.indexOf(e,x),M=[],w=0;w<b;w+=1)M[w]=0;if(-1!==k){var _=n(e,{errors:0,currentLocation:k,expectedLocation:x,distance:u});if(S=Math.min(_,S),-1!==(k=t.lastIndexOf(e,x+m))){var O=n(e,{errors:0,currentLocation:k,expectedLocation:x,distance:u});S=Math.min(O,S)}}k=-1;for(var j=[],A=1,P=m+b,I=1<<(m<=31?m-1:30),C=0;C<m;C+=1){for(var L=0,F=P;L<F;){n(e,{errors:C,currentLocation:x+F,expectedLocation:x,distance:u})<=S?L=F:P=F,F=Math.floor((P-L)/2+L)}P=F;var E=Math.max(1,x-F+1),N=v?b:Math.min(x+F,b)+m,$=Array(N+2);$[N+1]=(1<<C)-1;for(var z=N;z>=E;z-=1){var D=z-1,T=r[t.charAt(D)];if(T&&(M[D]=1),$[z]=($[z+1]<<1|1)&T,0!==C&&($[z]|=(j[z+1]|j[z])<<1|1|j[z+1]),$[z]&I&&(A=n(e,{errors:C,currentLocation:D,expectedLocation:x,distance:u}))<=S){if(S=A,(k=D)<=x)break;E=Math.max(1,2*x-k)}}if(n(e,{errors:C+1,currentLocation:x,expectedLocation:x,distance:u})>S)break;j=$}var W={isMatch:k>=0,score:A||.001};return g&&(W.matchedIndices=i(M,d)),W}},function(t,e){t.exports=function(t,e){var r=e.errors,n=void 0===r?0:r,i=e.currentLocation,o=void 0===i?0:i,s=e.expectedLocation,a=void 0===s?0:s,c=e.distance,u=void 0===c?100:c,h=n/t.length,f=Math.abs(a-o);return u?h+f/u:f?1:h}},function(t,e){t.exports=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=[],n=-1,i=-1,o=0,s=t.length;o<s;o+=1){var a=t[o];a&&-1===n?n=o:a||-1===n||((i=o-1)-n+1>=e&&r.push([n,i]),n=-1)}return t[o-1]&&o-n>=e&&r.push([n,o-1]),r}},function(t,e){t.exports=function(t){for(var e={},r=t.length,n=0;n<r;n+=1)e[t.charAt(n)]=0;for(var i=0;i<r;i+=1)e[t.charAt(i)]|=1<<r-i-1;return e}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(12),o=r(13),s=r(14),a=r(15),c=r(16),u=r(17),h=r(1),f=r(0).isString,l=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=r.isCaseSensitive;this.query=null,this.options=r,this._fuzzyCache={},f(e)&&e.trim().length>0&&(this.pattern=n?e:e.toLowerCase(),this.query=function(t){return t.split("|").map((function(t){return t.trim().split(/ +/g)}))}(this.pattern))}var e,r,l;return e=t,(r=[{key:"searchIn",value:function(t){var e=this.query;if(!this.query)return{isMatch:!1,score:1};var r=t.$;r=this.options.isCaseSensitive?r:r.toLowerCase();for(var n=!1,i=0,o=e.length;i<o;i+=1){var s=e[i],a=null;n=!0;for(var c=0,u=s.length;c<u;c+=1){var h=s[c];if(!(a=this._search(h,r)).isMatch){n=!1;break}}if(n)return a}return{isMatch:!1,score:1}}},{key:"_search",value:function(t,e){if(i.isForPattern(t))return i.match(t,e);if(s.isForPattern(t))return s.match(t,e);if(a.isForPattern(t))return a.match(t,e);if(u.isForPattern(t))return u.match(t,e);if(c.isForPattern(t))return c.match(t,e);if(o.isForPattern(t))return o.match(t,e);var r=this._fuzzyCache[t];return r||(r=new h(t,this.options),this._fuzzyCache[t]=r),r.search(e)}}])&&n(e.prototype,r),l&&n(e,l),t}();t.exports=l},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"'"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.indexOf(n)>-1,score:0}}}},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:-1===e.indexOf(n),score:0}}}},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"^"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.startsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substr(2)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)&&"^"==t.charAt(1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:!e.startsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substr(0,t.length-1)};t.exports={isForPattern:function(t){return"$"==t.charAt(t.length-1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.endsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substring(1,t.length-1)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)&&"$"==t.charAt(t.length-1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:!e.endsWith(n),score:0}}}},function(t,e,r){function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=r(3),s=r(19).jaccardDistance,a=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{threshold:.6};n(this,t),this.options=r,this.patternNgram=o(e,{sort:!0})}var e,r,a;return e=t,(r=[{key:"searchIn",value:function(t){var e=t.ng;e||(e=o(t.$,{sort:!0}),t.ng=e);var r=s(this.patternNgram,e),n=r<this.options.threshold;return{score:n?r:1,isMatch:n}}}])&&i(e.prototype,r),a&&i(e,a),t}();t.exports=a},function(t,e,r){t.exports={jaccardDistance:r(20)}},function(t,e,r){var n=r(21),i=n.union,o=n.intersection;t.exports=function(t,e){var r=i(t,e);return 1-o(t,e).length/r.length}},function(t,e,r){t.exports={union:r(22),intersection:r(23)}},function(t,e){t.exports=function(t,e){for(var r=[],n=0,i=0;n<t.length&&i<e.length;){var o=t[n],s=e[i];o<s?(r.push(o),n+=1):s<o?(r.push(s),i+=1):(r.push(s),n+=1,i+=1)}for(;n<t.length;)r.push(t[n]),n+=1;for(;i<e.length;)r.push(e[i]),i+=1;return r}},function(t,e){t.exports=function(t,e){for(var r=[],n=0,i=0;n<t.length&&i<e.length;){var o=t[n],s=e[i];o==s?(r.push(o),n+=1,i+=1):o<s?n+=1:(o>s||(n+=1),i+=1)}return r}},function(t,e,r){t.exports={createIndex:r(25),KeyStore:r(26)}},function(t,e,r){var n=r(0),i=n.isArray,o=n.isDefined,s=n.isString,a=r(4),c=r(3);t.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,u=void 0===n?a:n,h=r.ngrams,f=void 0!==h&&h,l=[];if(s(e[0]))for(var v=0,p=e.length;v<p;v+=1){var d=e[v];if(o(d)){var y={$:d,idx:v};f&&(y.ng=c(d,{sort:!0})),l.push(y)}}else for(var g=t.length,m=0,b=e.length;m<b;m+=1){for(var x=e[m],S={idx:m,$:{}},k=0;k<g;k+=1){var M=t[k],w=u(x,M);if(o(w))if(i(w)){for(var _=[],O=[{arrayIndex:-1,value:w}];O.length;){var j=O.pop(),A=j.arrayIndex,P=j.value;if(o(P))if(s(P)){var I={$:P,idx:A};f&&(I.ng=c(P,{sort:!0})),_.push(I)}else if(i(P))for(var C=0,L=P.length;C<L;C+=1)O.push({arrayIndex:C,value:P[C]})}S.$[M]=_}else{var F={$:w};f&&(F.ng=c(w,{sort:!0})),S.$[M]=F}}l.push(S)}return l}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(0).isString,o=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._keys={},this._keyNames=[],this._length=e.length,this._hasWeights=!1,e.length&&i(e[0]))for(var r=0;r<this._length;r+=1){var n=e[r];this._keys[n]={weight:1},this._keyNames.push(n)}else{for(var o=0,s=0;s<this._length;s+=1){var a=e[s];if(!a.hasOwnProperty("name"))throw new Error('Missing "name" property in key object');var c=a.name;if(this._keyNames.push(c),!a.hasOwnProperty("weight"))throw new Error('Missing "weight" property in key object');var u=a.weight;if(u<=0||u>=1)throw new Error('"weight" property in key must bein the range of (0, 1)');this._keys[c]={weight:u},o+=u,this._hasWeights=!0}if(o>1)throw new Error("Total of keyWeights cannot exceed 1")}}var e,r,o;return e=t,(r=[{key:"get",value:function(t,e){return this._keys[t]?this._keys[t][e]:null}},{key:"keys",value:function(){return this._keyNames}},{key:"count",value:function(){return this._length}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}])&&n(e.prototype,r),o&&n(e,o),t}();t.exports=o},function(t,e,r){t.exports={transformMatches:r(28),transformScore:r(29)}},function(t,e,r){var n=r(0),i=(n.isArray,n.isDefined);n.isString,n.isNumber,n.isObject;t.exports=function(t,e){var r=t.matches;if(e.matches=[],i(r))for(var n=0,o=r.length;n<o;n+=1){var s=r[n];if(i(s.indices)&&0!==s.indices.length){var a={indices:s.indices,value:s.value};s.key&&(a.key=s.key),s.idx>-1&&(a.refIndex=s.idx),e.matches.push(a)}}}},function(t,e){t.exports=function(t,e){e.score=t.score}}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Fuse",[],e):"object"==typeof exports?exports.Fuse=e():t.Fuse=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports={isDefined:function(t){return null!=t},isArray:function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:function(t){return"object"===r(t)},toString:function(t){return null==t?"":function(t){if("string"==typeof t)return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(7),o=r(10),s=r(2).MAX_BITS,a=function(){function t(e,r){var n=r.location,i=void 0===n?0:n,a=r.distance,c=void 0===a?100:a,u=r.threshold,h=void 0===u?.6:u,f=r.isCaseSensitive,l=void 0!==f&&f,v=r.findAllMatches,p=void 0!==v&&v,d=r.minMatchCharLength,y=void 0===d?1:d,g=r.includeMatches,m=void 0!==g&&g;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={location:i,distance:c,threshold:h,isCaseSensitive:l,findAllMatches:p,includeMatches:m,minMatchCharLength:y},e.length>s)throw new Error("Pattern length exceeds max of ".concat(s,"."));this.pattern=l?e:e.toLowerCase(),this.patternAlphabet=o(this.pattern)}var e,r,a;return e=t,(r=[{key:"searchIn",value:function(t){var e=t.$,r=this.options,n=r.isCaseSensitive,o=r.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var s={isMatch:!0,score:0};return o&&(s.matchedIndices=[[0,e.length-1]]),s}var a=this.options,c=a.location,u=a.distance,h=a.threshold,f=a.findAllMatches,l=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:c,distance:u,threshold:h,findAllMatches:f,minMatchCharLength:l,includeMatches:o})}}])&&n(e.prototype,r),a&&n(e,a),t}();t.exports=a},function(t,e){t.exports.MAX_BITS=32},function(t,e){t.exports=function(t,e){var r=e.n,n=void 0===r?3:r,i=e.pad,o=void 0===i||i,s=e.sort,a=void 0!==s&&s,c=[];if(null==t)return c;t=t.toLowerCase(),o&&(t=" ".concat(t," "));var u=t.length-n+1;if(u<1)return c;for(;u--;)c[u]=t.substr(u,n);return a&&c.sort((function(t,e){return t==e?0:t<e?-1:1})),c}},function(t,e,r){var n=r(0),i=n.isDefined,o=n.isString,s=n.isNumber,a=n.isArray,c=n.toString;t.exports=function(t,e){var r=[],n=!1;return function t(e,u){if(u){var h=u.indexOf("."),f=u,l=null;-1!==h&&(f=u.slice(0,h),l=u.slice(h+1));var v=e[f];if(i(v))if(l||!o(v)&&!s(v))if(a(v)){n=!0;for(var p=0,d=v.length;p<d;p+=1)t(v[p],l)}else l&&t(v,l);else r.push(c(v))}else r.push(e)}(t,e),n?r:r[0]}},function(t,e,r){function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var c=r(6),u=c.BitapSearch,h=c.ExtendedSearch,f=c.NGramSearch,l=r(0),v=l.isArray,p=l.isDefined,d=l.isString,y=l.isNumber,g=(l.isObject,r(4)),m=r(24),b=m.createIndex,x=m.KeyStore,S=r(27),k=S.transformMatches,M=S.transformScore,w=r(2).MAX_BITS,_={isCaseSensitive:!1,distance:100,findAllMatches:!1,getFn:g,includeMatches:!1,includeScore:!1,keys:[],location:0,minMatchCharLength:1,shouldSort:!0,sortFn:function(t,e){return t.score-e.score},threshold:.6,useExtendedSearch:!1},O=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;s(this,t),this.options=i({},_,{},r),this.options.isCaseSensitive=r.caseSensitive,delete this.options.caseSensitive,this._processKeys(this.options.keys),this.setCollection(e,n)}var e,r,n;return e=t,(r=[{key:"setCollection",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.list=t,this.listIsStringArray=d(t[0]),e?this.setIndex(e):this.setIndex(this._createIndex())}},{key:"setIndex",value:function(t){this._indexedList=t}},{key:"_processKeys",value:function(e){this._keyStore=new x(e),t.verbose}},{key:"_createIndex",value:function(){return b(this._keyStore.keys(),this.list,{getFn:this.options.getFn})}},{key:"search",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1},r=this.options,n=r.useExtendedSearch,i=r.shouldSort,o=null;o=n?new h(t,this.options):t.length>w?new f(t,this.options):new u(t,this.options);var s=this._searchUsing(o);return this._computeScore(s),i&&this._sort(s),e.limit&&y(e.limit)&&(s=s.slice(0,e.limit)),this._format(s)}},{key:"_searchUsing",value:function(t){var e=this._indexedList,r=[],n=this.options.includeMatches;if(this.listIsStringArray)for(var i=0,o=e.length;i<o;i+=1){var s=e[i],a=s.$,c=s.idx;if(p(a)){var u=t.searchIn(s),h=u.isMatch,f=u.score;if(h){var l={score:f,value:a};n&&(l.indices=u.matchedIndices),r.push({item:a,idx:c,matches:[l]})}}}else for(var d=this._keyStore.keys(),y=this._keyStore.count(),g=0,m=e.length;g<m;g+=1){var b=e[g],x=b.$,S=b.idx;if(p(x)){for(var k=[],M=0;M<y;M+=1){var w=d[M],_=x[w];if(p(_))if(v(_))for(var O=0,j=_.length;O<j;O+=1){var A=_[O],P=A.$,I=A.idx;if(p(P)){var C=t.searchIn(A),L=C.isMatch,F=C.score;if(L){var N={score:F,key:w,value:P,idx:I};n&&(N.indices=C.matchedIndices),k.push(N)}}}else{var E=_.$,$=t.searchIn(_),z=$.isMatch,D=$.score;if(!z)continue;var T={score:D,key:w,value:E};n&&(T.indices=$.matchedIndices),k.push(T)}}k.length&&r.push({idx:S,item:x,matches:k})}}return r}},{key:"_computeScore",value:function(t){for(var e=0,r=t.length;e<r;e+=1){for(var n=t[e],i=n.matches,o=i.length,s=1,a=0;a<o;a+=1){var c=i[a],u=c.key,h=this._keyStore.get(u,"weight"),f=h>-1?h:1,l=0===c.score&&h>-1?Number.EPSILON:c.score;s*=Math.pow(l,f)}n.score=s}}},{key:"_sort",value:function(t){t.sort(this.options.sortFn)}},{key:"_format",value:function(t){var e=[],r=this.options,n=r.includeMatches,i=r.includeScore,o=[];n&&o.push(k),i&&o.push(M);for(var s=0,a=t.length;s<a;s+=1){var c=t[s],u=c.idx,h={item:this.list[u],refIndex:u};if(o.length)for(var f=0,l=o.length;f<l;f+=1)o[f](c,h);e.push(h)}return e}}])&&a(e.prototype,r),n&&a(e,n),t}();O.createIndex=b,t.exports=O},function(t,e,r){t.exports={BitapSearch:r(1),ExtendedSearch:r(11),NGramSearch:r(18)}},function(t,e,r){var n=r(8),i=r(9);t.exports=function(t,e,r,o){for(var s=o.location,a=void 0===s?0:s,c=o.distance,u=void 0===c?100:c,h=o.threshold,f=void 0===h?.6:h,l=o.findAllMatches,v=void 0!==l&&l,p=o.minMatchCharLength,d=void 0===p?1:p,y=o.includeMatches,g=void 0!==y&&y,m=e.length,b=t.length,x=Math.max(0,Math.min(a,b)),S=f,k=t.indexOf(e,x),M=[],w=0;w<b;w+=1)M[w]=0;if(-1!==k){var _=n(e,{errors:0,currentLocation:k,expectedLocation:x,distance:u});if(S=Math.min(_,S),-1!==(k=t.lastIndexOf(e,x+m))){var O=n(e,{errors:0,currentLocation:k,expectedLocation:x,distance:u});S=Math.min(O,S)}}k=-1;for(var j=[],A=1,P=m+b,I=1<<(m<=31?m-1:30),C=0;C<m;C+=1){for(var L=0,F=P;L<F;){n(e,{errors:C,currentLocation:x+F,expectedLocation:x,distance:u})<=S?L=F:P=F,F=Math.floor((P-L)/2+L)}P=F;var N=Math.max(1,x-F+1),E=v?b:Math.min(x+F,b)+m,$=Array(E+2);$[E+1]=(1<<C)-1;for(var z=E;z>=N;z-=1){var D=z-1,T=r[t.charAt(D)];if(T&&(M[D]=1),$[z]=($[z+1]<<1|1)&T,0!==C&&($[z]|=(j[z+1]|j[z])<<1|1|j[z+1]),$[z]&I&&(A=n(e,{errors:C,currentLocation:D,expectedLocation:x,distance:u}))<=S){if(S=A,(k=D)<=x)break;N=Math.max(1,2*x-k)}}if(n(e,{errors:C+1,currentLocation:x,expectedLocation:x,distance:u})>S)break;j=$}var B={isMatch:k>=0,score:A||.001};return g&&(B.matchedIndices=i(M,d)),B}},function(t,e){t.exports=function(t,e){var r=e.errors,n=void 0===r?0:r,i=e.currentLocation,o=void 0===i?0:i,s=e.expectedLocation,a=void 0===s?0:s,c=e.distance,u=void 0===c?100:c,h=n/t.length,f=Math.abs(a-o);return u?h+f/u:f?1:h}},function(t,e){t.exports=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=[],n=-1,i=-1,o=0,s=t.length;o<s;o+=1){var a=t[o];a&&-1===n?n=o:a||-1===n||((i=o-1)-n+1>=e&&r.push([n,i]),n=-1)}return t[o-1]&&o-n>=e&&r.push([n,o-1]),r}},function(t,e){t.exports=function(t){for(var e={},r=t.length,n=0;n<r;n+=1)e[t.charAt(n)]=0;for(var i=0;i<r;i+=1)e[t.charAt(i)]|=1<<r-i-1;return e}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(12),o=r(13),s=r(14),a=r(15),c=r(16),u=r(17),h=r(1),f=r(0).isString,l=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=r.isCaseSensitive;this.query=null,this.options=r,this._fuzzyCache={},f(e)&&e.trim().length>0&&(this.pattern=n?e:e.toLowerCase(),this.query=function(t){return t.split("|").map((function(t){return t.trim().split(/ +/g)}))}(this.pattern))}var e,r,l;return e=t,(r=[{key:"searchIn",value:function(t){var e=this.query;if(!this.query)return{isMatch:!1,score:1};var r=t.$;r=this.options.isCaseSensitive?r:r.toLowerCase();for(var n=!1,i=0,o=e.length;i<o;i+=1){var s=e[i],a=null;n=!0;for(var c=0,u=s.length;c<u;c+=1){var h=s[c];if(!(a=this._search(h,r)).isMatch){n=!1;break}}if(n)return a}return{isMatch:!1,score:1}}},{key:"_search",value:function(t,e){if(i.isForPattern(t))return i.match(t,e);if(s.isForPattern(t))return s.match(t,e);if(a.isForPattern(t))return a.match(t,e);if(u.isForPattern(t))return u.match(t,e);if(c.isForPattern(t))return c.match(t,e);if(o.isForPattern(t))return o.match(t,e);var r=this._fuzzyCache[t];return r||(r=new h(t,this.options),this._fuzzyCache[t]=r),r.search(e)}}])&&n(e.prototype,r),l&&n(e,l),t}();t.exports=l},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"'"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.indexOf(n)>-1,score:0}}}},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:-1===e.indexOf(n),score:0}}}},function(t,e){var r=function(t){return t.substr(1)};t.exports={isForPattern:function(t){return"^"==t.charAt(0)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.startsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substr(2)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)&&"^"==t.charAt(1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:!e.startsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substr(0,t.length-1)};t.exports={isForPattern:function(t){return"$"==t.charAt(t.length-1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:e.endsWith(n),score:0}}}},function(t,e){var r=function(t){return t.substring(1,t.length-1)};t.exports={isForPattern:function(t){return"!"==t.charAt(0)&&"$"==t.charAt(t.length-1)},sanitize:r,match:function(t,e){var n=r(t);return{isMatch:!e.endsWith(n),score:0}}}},function(t,e,r){function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var o=r(3),s=r(19).jaccardDistance,a=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{threshold:.6};n(this,t),this.options=r,this.patternNgram=o(e,{sort:!0})}var e,r,a;return e=t,(r=[{key:"searchIn",value:function(t){var e=t.ng;e||(e=o(t.$,{sort:!0}),t.ng=e);var r=s(this.patternNgram,e),n=r<this.options.threshold;return{score:n?r:1,isMatch:n}}}])&&i(e.prototype,r),a&&i(e,a),t}();t.exports=a},function(t,e,r){t.exports={jaccardDistance:r(20)}},function(t,e,r){var n=r(21),i=n.union,o=n.intersection;t.exports=function(t,e){var r=i(t,e);return 1-o(t,e).length/r.length}},function(t,e,r){t.exports={union:r(22),intersection:r(23)}},function(t,e){t.exports=function(t,e){for(var r=[],n=0,i=0;n<t.length&&i<e.length;){var o=t[n],s=e[i];o<s?(r.push(o),n+=1):s<o?(r.push(s),i+=1):(r.push(s),n+=1,i+=1)}for(;n<t.length;)r.push(t[n]),n+=1;for(;i<e.length;)r.push(e[i]),i+=1;return r}},function(t,e){t.exports=function(t,e){for(var r=[],n=0,i=0;n<t.length&&i<e.length;){var o=t[n],s=e[i];o==s?(r.push(o),n+=1,i+=1):o<s?n+=1:(o>s||(n+=1),i+=1)}return r}},function(t,e,r){t.exports={createIndex:r(25),KeyStore:r(26)}},function(t,e,r){var n=r(0),i=n.isArray,o=n.isDefined,s=n.isString,a=r(4),c=r(3);t.exports=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.getFn,u=void 0===n?a:n,h=r.ngrams,f=void 0!==h&&h,l=[];if(s(e[0]))for(var v=0,p=e.length;v<p;v+=1){var d=e[v];if(o(d)){var y={$:d,idx:v};f&&(y.ng=c(d,{sort:!0})),l.push(y)}}else for(var g=t.length,m=0,b=e.length;m<b;m+=1){for(var x=e[m],S={idx:m,$:{}},k=0;k<g;k+=1){var M=t[k],w=u(x,M);if(o(w))if(i(w)){for(var _=[],O=[{arrayIndex:-1,value:w}];O.length;){var j=O.pop(),A=j.arrayIndex,P=j.value;if(o(P))if(s(P)){var I={$:P,idx:A};f&&(I.ng=c(P,{sort:!0})),_.push(I)}else if(i(P))for(var C=0,L=P.length;C<L;C+=1)O.push({arrayIndex:C,value:P[C]})}S.$[M]=_}else{var F={$:w};f&&(F.ng=c(w,{sort:!0})),S.$[M]=F}}l.push(S)}return l}},function(t,e,r){function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var i=r(0).isString,o=function(){function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._keys={},this._keyNames=[],this._length=e.length,e.length&&i(e[0]))for(var r=0;r<this._length;r+=1){var n=e[r];this._keys[n]={weight:1},this._keyNames.push(n)}else{for(var o=0,s=0;s<this._length;s+=1){var a=e[s];if(!a.hasOwnProperty("name"))throw new Error('Missing "name" property in key object');var c=a.name;if(this._keyNames.push(c),!a.hasOwnProperty("weight"))throw new Error('Missing "weight" property in key object');var u=a.weight;if(u<=0||u>=1)throw new Error('"weight" property in key must bein the range of (0, 1)');this._keys[c]={weight:u},o+=u}for(var h=0;h<this._length;h+=1){var f=this._keyNames[h],l=this._keys[f].weight;this._keys[f].weight=l/o}}}var e,r,o;return e=t,(r=[{key:"get",value:function(t,e){return this._keys[t]?this._keys[t][e]:-1}},{key:"keys",value:function(){return this._keyNames}},{key:"count",value:function(){return this._length}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}])&&n(e.prototype,r),o&&n(e,o),t}();t.exports=o},function(t,e,r){t.exports={transformMatches:r(28),transformScore:r(29)}},function(t,e,r){var n=r(0),i=(n.isArray,n.isDefined);n.isString,n.isNumber,n.isObject;t.exports=function(t,e){var r=t.matches;if(e.matches=[],i(r))for(var n=0,o=r.length;n<o;n+=1){var s=r[n];if(i(s.indices)&&0!==s.indices.length){var a={indices:s.indices,value:s.value};s.key&&(a.key=s.key),s.idx>-1&&(a.refIndex=s.idx),e.matches.push(a)}}}},function(t,e){t.exports=function(t,e){e.score=t.score}}])})); |
/*! | ||
* Fuse.js v5.0.5-beta - Lightweight fuzzy-search (http://fusejs.io) | ||
* Fuse.js v5.0.6-beta - Lightweight fuzzy-search (http://fusejs.io) | ||
* | ||
@@ -444,4 +444,4 @@ * Copyright (c) 2012-2020 Kirollos Risk (http://kiro.me) | ||
var weight = keyWeight || 1; | ||
var score = item.score === 0 && keyWeight && keyWeight > 0 ? Number.EPSILON : item.score; | ||
var weight = keyWeight > -1 ? keyWeight : 1; | ||
var score = item.score === 0 && keyWeight > -1 ? Number.EPSILON : item.score; | ||
totalWeightedScore *= Math.pow(score, weight); // Keep track of the best score.. just in case | ||
@@ -1694,4 +1694,3 @@ // Actually, we're not really using it.. but need to think of a way to incorporate this | ||
this._keyNames = []; | ||
this._length = keys.length; | ||
this._hasWeights = false; // Iterate over every key | ||
this._length = keys.length; // Iterate over every key | ||
@@ -1708,3 +1707,3 @@ if (keys.length && isString(keys[0])) { | ||
} else { | ||
var keyWeightsTotal = 0; | ||
var totalWeight = 0; | ||
@@ -1726,5 +1725,5 @@ for (var _i = 0; _i < this._length; _i += 1) { | ||
var keyWeight = _key.weight; | ||
var weight = _key.weight; | ||
if (keyWeight <= 0 || keyWeight >= 1) { | ||
if (weight <= 0 || weight >= 1) { | ||
throw new Error('"weight" property in key must bein the range of (0, 1)'); | ||
@@ -1734,10 +1733,12 @@ } | ||
this._keys[keyName] = { | ||
weight: keyWeight | ||
weight: weight | ||
}; | ||
keyWeightsTotal += keyWeight; | ||
this._hasWeights = true; | ||
} | ||
totalWeight += weight; | ||
} // Normalize weights so that their sum is equal to 1 | ||
if (keyWeightsTotal > 1) { | ||
throw new Error('Total of keyWeights cannot exceed 1'); | ||
for (var _i2 = 0; _i2 < this._length; _i2 += 1) { | ||
var _keyName = this._keyNames[_i2]; | ||
var keyWeight = this._keys[_keyName].weight; | ||
this._keys[_keyName].weight = keyWeight / totalWeight; | ||
} | ||
@@ -1750,3 +1751,3 @@ } | ||
value: function get(key, name) { | ||
return this._keys[key] ? this._keys[key][name] : null; | ||
return this._keys[key] ? this._keys[key][name] : -1; | ||
} | ||
@@ -1753,0 +1754,0 @@ }, { |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "5.0.5-beta", | ||
"version": "5.0.6-beta", | ||
"description": "Lightweight fuzzy-search", | ||
@@ -11,0 +11,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
342236