Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fuse.js

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuse.js - npm Package Compare versions

Comparing version 3.4.3 to 3.4.4

3

dist/fuse.d.ts

@@ -1,2 +0,3 @@

// Type definitions for Fuse.js 3.2.0
// Type definitions for Fuse.js 3.4
// TypeScript Version: 3.1

@@ -3,0 +4,0 @@ export = Fuse;

/*!
* Fuse.js v3.4.3 - Lightweight fuzzy-search (http://fusejs.io)
* Fuse.js v3.4.4 - Lightweight fuzzy-search (http://fusejs.io)
*

@@ -9,2 +9,2 @@ * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)

*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Fuse",[],t):"object"==typeof exports?exports.Fuse=t():e.Fuse=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=(e=>Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e))},function(e,t,n){const r=n(2),o=n(8),s=n(0);e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:r=.6,maxPatternLength:s=32,caseSensitive:i=!1,tokenSeparator:l=/ +/g,findAllMatches:a=!1,minMatchCharLength:c=1,id:h=null,keys:u=[],shouldSort:p=!0,getFn:f=o,sortFn:d=((e,t)=>e.score-t.score),tokenize:g=!1,matchAllTokens:m=!1,includeMatches:y=!1,includeScore:x=!1,verbose:S=!1}){this.options={location:t,distance:n,threshold:r,maxPatternLength:s,isCaseSensitive:i,tokenSeparator:l,findAllMatches:a,minMatchCharLength:c,id:h,keys:u,includeMatches:y,includeScore:x,shouldSort:p,getFn:f,sortFn:d,verbose:S,tokenize:g,matchAllTokens:m},this.setCollection(e)}setCollection(e){return this.list=e,e}search(e,t={limit:!1}){this._log(`---------\nSearch pattern: "${e}"`);const{tokenSearchers:n,fullSearcher:r}=this._prepareSearchers(e);let{weights:o,results:s}=this._search(n,r);return this._computeScore(o,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}_prepareSearchers(e=""){const t=[];if(this.options.tokenize){const n=e.split(this.options.tokenSeparator);for(let e=0,o=n.length;e<o;e+=1)t.push(new r(n[e],this.options))}return{tokenSearchers:t,fullSearcher:new r(e,this.options)}}_search(e=[],t){const n=this.list,r={},o=[];if("string"==typeof n[0]){for(let s=0,i=n.length;s<i;s+=1)this._analyze({key:"",value:n[s],record:s,index:s},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t});return{weights:null,results:o}}const s={};for(let i=0,l=n.length;i<l;i+=1){let l=n[i];for(let n=0,a=this.options.keys.length;n<a;n+=1){let a=this.options.keys[n];if("string"!=typeof a){if(s[a.name]={weight:1-a.weight||1},a.weight<=0||a.weight>1)throw new Error("Key weight has to be > 0 and <= 1");a=a.name}else s[a]={weight:1};this._analyze({key:a,value:this.options.getFn(l,a),record:l,index:i},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}}return{weights:s,results:o}}_analyze({key:e,arrayIndex:t=-1,value:n,record:r,index:o},{tokenSearchers:i=[],fullSearcher:l=[],resultMap:a={},results:c=[]}){if(null==n)return;let h=!1,u=-1,p=0;if("string"==typeof n){this._log(`\nKey: ${""===e?"-":e}`);let s=l.search(n);if(this._log(`Full text: "${n}", score: ${s.score}`),this.options.tokenize){let e=n.split(this.options.tokenSeparator),t=[];for(let n=0;n<i.length;n+=1){let r=i[n];this._log(`\nPattern: "${r.pattern}"`);let o=!1;for(let n=0;n<e.length;n+=1){let s=e[n],i=r.search(s),l={};i.isMatch?(l[s]=i.score,h=!0,o=!0,t.push(i.score)):(l[s]=1,this.options.matchAllTokens||t.push(1)),this._log(`Token: "${s}", score: ${l[s]}`)}o&&(p+=1)}u=t[0];let r=t.length;for(let e=1;e<r;e+=1)u+=t[e];u/=r,this._log("Token score average:",u)}let f=s.score;u>-1&&(f=(f+u)/2),this._log("Score average:",f);let d=!this.options.tokenize||!this.options.matchAllTokens||p>=i.length;if(this._log(`\nCheck Matches: ${d}`),(h||s.isMatch)&&d){let i=a[o];i?i.output.push({key:e,arrayIndex:t,value:n,score:f,matchedIndices:s.matchedIndices}):(a[o]={item:r,output:[{key:e,arrayIndex:t,value:n,score:f,matchedIndices:s.matchedIndices}]},c.push(a[o]))}}else if(s(n))for(let t=0,s=n.length;t<s;t+=1)this._analyze({key:e,arrayIndex:t,value:n[t],record:r,index:o},{resultMap:a,results:c,tokenSearchers:i,fullSearcher:l})}_computeScore(e,t){this._log("\n\nComputing score:\n");for(let n=0,r=t.length;n<r;n+=1){const r=t[n].output,o=r.length;let s=1,i=1;for(let t=0;t<o;t+=1){let n=e?e[r[t].key].weight:1,o=(1===n?r[t].score:r[t].score||.001)*n;1!==n?i=Math.min(i,o):(r[t].nScore=o,s*=o)}t[n].score=1===i?s:i,this._log(t[n])}}_sort(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}_format(e){const t=[];if(this.options.verbose){let t=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,function(e,n){if("object"==typeof n&&null!==n){if(-1!==t.indexOf(n))return;t.push(n)}return n})),t=null}let n=[];this.options.includeMatches&&n.push((e,t)=>{const n=e.output;t.matches=[];for(let e=0,r=n.length;e<r;e+=1){let r=n[e];if(0===r.matchedIndices.length)continue;let o={indices:r.matchedIndices,value:r.value};r.key&&(o.key=r.key),r.hasOwnProperty("arrayIndex")&&r.arrayIndex>-1&&(o.arrayIndex=r.arrayIndex),t.matches.push(o)}}),this.options.includeScore&&n.push((e,t)=>{t.score=e.score});for(let r=0,o=e.length;r<o;r+=1){const o=e[r];if(this.options.id&&(o.item=this.options.getFn(o.item,this.options.id)[0]),!n.length){t.push(o.item);continue}const s={item:o.item};for(let e=0,t=n.length;e<t;e+=1)n[e](o,s);t.push(s)}return t}_log(){this.options.verbose&&console.log(...arguments)}}},function(e,t,n){const r=n(3),o=n(4),s=n(7);e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:r=.6,maxPatternLength:o=32,isCaseSensitive:i=!1,tokenSeparator:l=/ +/g,findAllMatches:a=!1,minMatchCharLength:c=1}){this.options={location:t,distance:n,threshold:r,maxPatternLength:o,isCaseSensitive:i,tokenSeparator:l,findAllMatches:a,minMatchCharLength:c},this.pattern=this.options.isCaseSensitive?e:e.toLowerCase(),this.pattern.length<=o&&(this.patternAlphabet=s(this.pattern))}search(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};const{maxPatternLength:t,tokenSeparator:n}=this.options;if(this.pattern.length>t)return r(e,this.pattern,n);const{location:s,distance:i,threshold:l,findAllMatches:a,minMatchCharLength:c}=this.options;return o(e,this.pattern,this.patternAlphabet,{location:s,distance:i,threshold:l,findAllMatches:a,minMatchCharLength:c})}}},function(e,t){const n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=((e,t,r=/ +/g)=>{let o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),s=e.match(o),i=!!s,l=[];if(i)for(let t=0,n=s.length;t<n;t+=1){let n=s[t];l.push([e.indexOf(n),n.length-1])}return{score:i?.5:1,isMatch:i,matchedIndices:l}})},function(e,t,n){const r=n(5),o=n(6);e.exports=((e,t,n,{location:s=0,distance:i=100,threshold:l=.6,findAllMatches:a=!1,minMatchCharLength:c=1})=>{const h=s,u=e.length;let p=l,f=e.indexOf(t,h);const d=t.length,g=[];for(let e=0;e<u;e+=1)g[e]=0;if(-1!==f){let n=r(t,{errors:0,currentLocation:f,expectedLocation:h,distance:i});if(p=Math.min(n,p),-1!==(f=e.lastIndexOf(t,h+d))){let e=r(t,{errors:0,currentLocation:f,expectedLocation:h,distance:i});p=Math.min(e,p)}}f=-1;let m=[],y=1,x=d+u;const S=1<<d-1;for(let o=0;o<d;o+=1){let s=0,l=x;for(;s<l;){r(t,{errors:o,currentLocation:h+l,expectedLocation:h,distance:i})<=p?s=l:x=l,l=Math.floor((x-s)/2+s)}x=l;let c=Math.max(1,h-l+1),k=a?u:Math.min(h+l,u)+d,M=Array(k+2);M[k+1]=(1<<o)-1;for(let s=k;s>=c;s-=1){let l=s-1,a=n[e.charAt(l)];if(a&&(g[l]=1),M[s]=(M[s+1]<<1|1)&a,0!==o&&(M[s]|=(m[s+1]|m[s])<<1|1|m[s+1]),M[s]&S&&(y=r(t,{errors:o,currentLocation:l,expectedLocation:h,distance:i}))<=p){if(p=y,(f=l)<=h)break;c=Math.max(1,2*h-f)}}if(r(t,{errors:o+1,currentLocation:h,expectedLocation:h,distance:i})>p)break;m=M}return{isMatch:f>=0,score:0===y?.001:y,matchedIndices:o(g,c)}})},function(e,t){e.exports=((e,{errors:t=0,currentLocation:n=0,expectedLocation:r=0,distance:o=100})=>{const s=t/e.length,i=Math.abs(r-n);return o?s+i/o:i?1:s})},function(e,t){e.exports=((e=[],t=1)=>{let n=[],r=-1,o=-1,s=0;for(let i=e.length;s<i;s+=1){let i=e[s];i&&-1===r?r=s:i||-1===r||((o=s-1)-r+1>=t&&n.push([r,o]),r=-1)}return e[s-1]&&s-r>=t&&n.push([r,s-1]),n})},function(e,t){e.exports=(e=>{let t={},n=e.length;for(let r=0;r<n;r+=1)t[e.charAt(r)]=0;for(let r=0;r<n;r+=1)t[e.charAt(r)]|=1<<n-r-1;return t})},function(e,t,n){const r=n(0),o=(e,t,n)=>{if(t){const s=t.indexOf(".");let i=t,l=null;-1!==s&&(i=t.slice(0,s),l=t.slice(s+1));const a=e[i];if(null!=a)if(l||"string"!=typeof a&&"number"!=typeof a)if(r(a))for(let e=0,t=a.length;e<t;e+=1)o(a[e],l,n);else l&&o(a,l,n);else n.push(a.toString())}else n.push(e);return n};e.exports=((e,t)=>o(e,t,[]))}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Fuse",[],t):"object"==typeof exports?exports.Fuse=t():e.Fuse=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=n(2),a=n(8),s=n(0),c=function(){function e(t,n){var r=n.location,o=void 0===r?0:r,i=n.distance,s=void 0===i?100:i,c=n.threshold,h=void 0===c?.6:c,l=n.maxPatternLength,u=void 0===l?32:l,f=n.caseSensitive,d=void 0!==f&&f,v=n.tokenSeparator,p=void 0===v?/ +/g:v,g=n.findAllMatches,y=void 0!==g&&g,m=n.minMatchCharLength,k=void 0===m?1:m,S=n.id,x=void 0===S?null:S,b=n.keys,M=void 0===b?[]:b,_=n.shouldSort,L=void 0===_||_,w=n.getFn,A=void 0===w?a:w,C=n.sortFn,I=void 0===C?function(e,t){return e.score-t.score}:C,O=n.tokenize,j=void 0!==O&&O,P=n.matchAllTokens,F=void 0!==P&&P,T=n.includeMatches,z=void 0!==T&&T,E=n.includeScore,K=void 0!==E&&E,$=n.verbose,J=void 0!==$&&$;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:o,distance:s,threshold:h,maxPatternLength:u,isCaseSensitive:d,tokenSeparator:p,findAllMatches:y,minMatchCharLength:k,id:x,keys:M,includeMatches:z,includeScore:K,shouldSort:L,getFn:A,sortFn:I,verbose:J,tokenize:j,matchAllTokens:F},this.setCollection(t)}var t,n,c;return t=e,(n=[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var n=this._prepareSearchers(e),r=n.tokenSearchers,o=n.fullSearcher,i=this._search(r,o),a=i.weights,s=i.results;return this._computeScore(a,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),r=0,o=n.length;r<o;r+=1)t.push(new i(n[r],this.options));return{tokenSearchers:t,fullSearcher:new i(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,r={},o=[];if("string"==typeof n[0]){for(var i=0,a=n.length;i<a;i+=1)this._analyze({key:"",value:n[i],record:i,index:i},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t});return{weights:null,results:o}}for(var s={},c=0,h=n.length;c<h;c+=1)for(var l=n[c],u=0,f=this.options.keys.length;u<f;u+=1){var d=this.options.keys[u];if("string"!=typeof d){if(s[d.name]={weight:1-d.weight||1},d.weight<=0||d.weight>1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else s[d]={weight:1};this._analyze({key:d,value:this.options.getFn(l,d),record:l,index:c},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:s,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,r=e.arrayIndex,o=void 0===r?-1:r,i=e.value,a=e.record,c=e.index,h=t.tokenSearchers,l=void 0===h?[]:h,u=t.fullSearcher,f=void 0===u?[]:u,d=t.resultMap,v=void 0===d?{}:d,p=t.results,g=void 0===p?[]:p;if(null!=i){var y=!1,m=-1,k=0;if("string"==typeof i){this._log("\nKey: ".concat(""===n?"-":n));var S=f.search(i);if(this._log('Full text: "'.concat(i,'", score: ').concat(S.score)),this.options.tokenize){for(var x=i.split(this.options.tokenSeparator),b=[],M=0;M<l.length;M+=1){var _=l[M];this._log('\nPattern: "'.concat(_.pattern,'"'));for(var L=!1,w=0;w<x.length;w+=1){var A=x[w],C=_.search(A),I={};C.isMatch?(I[A]=C.score,y=!0,L=!0,b.push(C.score)):(I[A]=1,this.options.matchAllTokens||b.push(1)),this._log('Token: "'.concat(A,'", score: ').concat(I[A]))}L&&(k+=1)}m=b[0];for(var O=b.length,j=1;j<O;j+=1)m+=b[j];m/=O,this._log("Token score average:",m)}var P=S.score;m>-1&&(P=(P+m)/2),this._log("Score average:",P);var F=!this.options.tokenize||!this.options.matchAllTokens||k>=l.length;if(this._log("\nCheck Matches: ".concat(F)),(y||S.isMatch)&&F){var T=v[c];T?T.output.push({key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}):(v[c]={item:a,output:[{key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}]},g.push(v[c]))}}else if(s(i))for(var z=0,E=i.length;z<E;z+=1)this._analyze({key:n,arrayIndex:z,value:i[z],record:a,index:c},{resultMap:v,results:g,tokenSearchers:l,fullSearcher:f})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var n=0,r=t.length;n<r;n+=1){for(var o=t[n].output,i=o.length,a=1,s=1,c=0;c<i;c+=1){var h=e?e[o[c].key].weight:1,l=(1===h?o[c].score:o[c].score||.001)*h;1!==h?s=Math.min(s,l):(o[c].nScore=l,a*=l)}t[n].score=1===s?a:s,this._log(t[n])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];if(this.options.verbose){var n=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,function(e,t){if("object"===r(t)&&null!==t){if(-1!==n.indexOf(t))return;n.push(t)}return t})),n=null}var o=[];this.options.includeMatches&&o.push(function(e,t){var n=e.output;t.matches=[];for(var r=0,o=n.length;r<o;r+=1){var i=n[r];if(0!==i.matchedIndices.length){var a={indices:i.matchedIndices,value:i.value};i.key&&(a.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var i=0,a=e.length;i<a;i+=1){var s=e[i];if(this.options.id&&(s.item=this.options.getFn(s.item,this.options.id)[0]),o.length){for(var c={item:s.item},h=0,l=o.length;h<l;h+=1)o[h](s,c);t.push(c)}else t.push(s.item)}return t}},{key:"_log",value:function(){var e;this.options.verbose&&(e=console).log.apply(e,arguments)}}])&&o(t.prototype,n),c&&o(t,c),e}();e.exports=c},function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(3),i=n(4),a=n(7),s=function(){function e(t,n){var r=n.location,o=void 0===r?0:r,i=n.distance,s=void 0===i?100:i,c=n.threshold,h=void 0===c?.6:c,l=n.maxPatternLength,u=void 0===l?32:l,f=n.isCaseSensitive,d=void 0!==f&&f,v=n.tokenSeparator,p=void 0===v?/ +/g:v,g=n.findAllMatches,y=void 0!==g&&g,m=n.minMatchCharLength,k=void 0===m?1:m;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:o,distance:s,threshold:h,maxPatternLength:u,isCaseSensitive:d,tokenSeparator:p,findAllMatches:y,minMatchCharLength:k},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=u&&(this.patternAlphabet=a(this.pattern))}var t,n,s;return t=e,(n=[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,n=t.maxPatternLength,r=t.tokenSeparator;if(this.pattern.length>n)return o(e,this.pattern,r);var a=this.options,s=a.location,c=a.distance,h=a.threshold,l=a.findAllMatches,u=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:s,distance:c,threshold:h,findAllMatches:l,minMatchCharLength:u})}}])&&r(t.prototype,n),s&&r(t,s),e}();e.exports=s},function(e,t){var n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c<h;c+=1){var l=i[c];s.push([e.indexOf(l),l.length-1])}return{score:a?.5:1,isMatch:a,matchedIndices:s}}},function(e,t,n){var r=n(5),o=n(6);e.exports=function(e,t,n,i){for(var a=i.location,s=void 0===a?0:a,c=i.distance,h=void 0===c?100:c,l=i.threshold,u=void 0===l?.6:l,f=i.findAllMatches,d=void 0!==f&&f,v=i.minMatchCharLength,p=void 0===v?1:v,g=s,y=e.length,m=u,k=e.indexOf(t,g),S=t.length,x=[],b=0;b<y;b+=1)x[b]=0;if(-1!==k){var M=r(t,{errors:0,currentLocation:k,expectedLocation:g,distance:h});if(m=Math.min(M,m),-1!==(k=e.lastIndexOf(t,g+S))){var _=r(t,{errors:0,currentLocation:k,expectedLocation:g,distance:h});m=Math.min(_,m)}}k=-1;for(var L=[],w=1,A=S+y,C=1<<S-1,I=0;I<S;I+=1){for(var O=0,j=A;O<j;){r(t,{errors:I,currentLocation:g+j,expectedLocation:g,distance:h})<=m?O=j:A=j,j=Math.floor((A-O)/2+O)}A=j;var P=Math.max(1,g-j+1),F=d?y:Math.min(g+j,y)+S,T=Array(F+2);T[F+1]=(1<<I)-1;for(var z=F;z>=P;z-=1){var E=z-1,K=n[e.charAt(E)];if(K&&(x[E]=1),T[z]=(T[z+1]<<1|1)&K,0!==I&&(T[z]|=(L[z+1]|L[z])<<1|1|L[z+1]),T[z]&C&&(w=r(t,{errors:I,currentLocation:E,expectedLocation:g,distance:h}))<=m){if(m=w,(k=E)<=g)break;P=Math.max(1,2*g-k)}}if(r(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:h})>m)break;L=T}return{isMatch:k>=0,score:0===w?.001:w,matchedIndices:o(x,p)}}},function(e,t){e.exports=function(e,t){var n=t.errors,r=void 0===n?0:n,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=r/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=-1,o=-1,i=0,a=e.length;i<a;i+=1){var s=e[i];s&&-1===r?r=i:s||-1===r||((o=i-1)-r+1>=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,r=0;r<n;r+=1)t[e.charAt(r)]=0;for(var o=0;o<n;o+=1)t[e.charAt(o)]|=1<<n-o-1;return t}},function(e,t,n){var r=n(0);e.exports=function(e,t){return function e(t,n,o){if(n){var i=n.indexOf("."),a=n,s=null;-1!==i&&(a=n.slice(0,i),s=n.slice(i+1));var c=t[a];if(null!=c)if(s||"string"!=typeof c&&"number"!=typeof c)if(r(c))for(var h=0,l=c.length;h<l;h+=1)e(c[h],s,o);else s&&e(c,s,o);else o.push(c.toString())}else o.push(t);return o}(e,t,[])}}])});

@@ -8,3 +8,3 @@ {

},
"version": "3.4.3",
"version": "3.4.4",
"description": "Lightweight fuzzy-search",

@@ -35,8 +35,8 @@ "license": "Apache-2.0",

"@babel/core": "^7.3.4",
"@babel/preset-env": "^7.3.1",
"@babel/preset-env": "7.3.4",
"@babel/preset-typescript": "^7.3.3",
"@types/jest": "^24.0.9",
"@types/jest": "^24.0.11",
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.0",
"jest": "^24.1.0",
"jest": "^24.3.1",
"rimraf": "^2.6.3",

@@ -43,0 +43,0 @@ "terser-webpack-plugin": "^1.2.3",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc