match-sorter
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -580,3 +580,4 @@ 'use strict'; | ||
// concat because `value` can be a string or an array | ||
return value ? [].concat(value) : null; | ||
// eslint-disable-next-line | ||
return value != null ? [].concat(value) : null; | ||
} | ||
@@ -583,0 +584,0 @@ |
@@ -578,3 +578,4 @@ function createCommonjsModule(fn, module) { | ||
// concat because `value` can be a string or an array | ||
return value ? [].concat(value) : null; | ||
// eslint-disable-next-line | ||
return value != null ? [].concat(value) : null; | ||
} | ||
@@ -581,0 +582,0 @@ |
@@ -584,3 +584,4 @@ (function (global, factory) { | ||
// concat because `value` can be a string or an array | ||
return value ? [].concat(value) : null; | ||
// eslint-disable-next-line | ||
return value != null ? [].concat(value) : null; | ||
} | ||
@@ -587,0 +588,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.matchSorter=t()}(this,function(){"use strict";var e,t=(function(e){!function(t,r){e.exports?e.exports=r():this.Diacritics=r()}(0,function(){for(var e={map:{}},t=[{base:" ",letters:" "},{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"Th",letters:"Þ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"ff",letters:"ff"},{base:"fi",letters:"fi"},{base:"fl",letters:"fl"},{base:"ffi",letters:"ffi"},{base:"ffl",letters:"ffl"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nñnⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥлԉ"},{base:"nj",letters:"nj"},{base:"o",letters:"߀oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oe",letters:"Œœ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"ss",letters:"ß"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"th",letters:"þ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],r=0,s=t.length;r<s;r++)for(var a=t[r].letters.split(""),n=0,l=a.length;n<l;n++)e.map[a[n]]=t[r].base;return e.clean=function(t){if(!t||!t.length||t.length<1)return"";for(var r,s="",a=t.split(""),n=0,l=a.length;n<l;n++)s+=(r=a[n])in e.map?e.map[r]:r;return s},e})}(e={exports:{}},e.exports),e.exports),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},s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},a={CASE_SENSITIVE_EQUAL:9,EQUAL:8,STARTS_WITH:7,WORD_STARTS_WITH:6,STRING_CASE:5,STRING_CASE_ACRONYM:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},n={CAMEL:.8,PASCAL:.6,KEBAB:.4,SNAKE:.2,NO_CASE:0};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return e;var l=n.keys,i=n.threshold,u=void 0===i?a.MATCHES:i;return e.reduce(function(e,o,i){var f=function(e,t,n,l){if(!t)return{rank:b(e,n,l),keyIndex:-1};return function(e,t){return t.reduce(function(t,a){var n=function(e,t){"object"===(void 0===t?"undefined":r(t))&&(t=t.key);var s=void 0;s="function"==typeof t?t(e):-1!==t.indexOf(".")?t.split(".").reduce(function(e,t){return e?e[t]:null},e):e[t];return s?[].concat(s):null}(e,a);return n&&n.forEach(function(e){t.push({itemValue:e,attributes:function(e){"string"==typeof e&&(e={key:e});return s({maxRanking:1/0,minRanking:-1/0},e)}(a)})}),t},[])}(e,t).reduce(function(e,t,r){var s=e.rank,o=e.keyIndex,i=t.itemValue,u=t.attributes,f=b(i,n,l),c=u.minRanking,A=u.maxRanking;return f<c&&f>=a.MATCHES?f=c:f>A&&(f=A),f>s&&(s=f,o=r),{rank:s,keyIndex:o}},{rank:a.NO_MATCH,keyIndex:-1})}(o,l,t,n),c=f.rank,A=f.keyIndex;return c>=u&&e.push({item:o,rank:c,index:i,keyIndex:A}),e},[]).sort(o).map(function(e){return e.item})}function b(e,t,r){if(e=i(e,r),(t=i(t,r)).length>e.length)return a.NO_MATCH;if(e===t)return a.CASE_SENSITIVE_EQUAL;var s,l,b=function(e){var t=e.toLowerCase()!==e,r=e.indexOf("-")>=0,s=e.indexOf("_")>=0;if(!t&&!s&&r)return n.KEBAB;if(!t&&s&&!r)return n.SNAKE;if(t&&!r&&!s){var a=e[0].toUpperCase()===e[0];return a?n.PASCAL:n.CAMEL}return n.NO_CASE}(e),o=function(e,t,r){var s=e.toLowerCase().indexOf(t.toLowerCase());switch(r){case n.SNAKE:return"_"===e[s-1];case n.KEBAB:return"-"===e[s-1];case n.PASCAL:case n.CAMEL:return-1!==s&&e[s]===e[s].toUpperCase();default:return!1}}(e,t,b),u=function(e,t,r){var s=null;switch(r){case n.SNAKE:s="_";break;case n.KEBAB:s="-";break;case n.PASCAL:case n.CAMEL:s=/(?=[A-Z])/;break;default:s=null}var a=e.split(s);return t.toLowerCase().split("").reduce(function(e,t,r){var s=a[r];return e&&s&&s[0].toLowerCase()===t},!0)}(e,t,b);return(e=e.toLowerCase())===(t=t.toLowerCase())?a.EQUAL+b:0===e.indexOf(t)?a.STARTS_WITH+b:-1!==e.indexOf(" "+t)?a.WORD_STARTS_WITH+b:o?a.STRING_CASE+b:b>0&&u?a.STRING_CASE_ACRONYM+b:-1!==e.indexOf(t)?a.CONTAINS+b:1===t.length?a.NO_MATCH:-1!==(s=e,l="",s.split(" ").forEach(function(e){e.split("-").forEach(function(e){l+=e.substr(0,1)})}),l).indexOf(t)?a.ACRONYM+b:function(e,t){var r=0;function s(e,t,r){for(var s=r;s<t.length;s++){var a=t[s];if(a===e)return s+1}return-1}var n=s(t[0],e,0);if(n<0)return a.NO_MATCH;r=n;for(var l=1;l<t.length;l++){var b=t[l],o=(r=s(b,e,r))>-1;if(!o)return a.NO_MATCH}return function(e){var r=e-t.length+1,s=a.MATCHES+1/r;return s}(r-n)}(e,t)}function o(e,t){var r=e.rank,s=e.index,a=e.keyIndex,n=t.rank,l=t.index,b=t.keyIndex;return r===n?a===b?s<l?-1:1:a<b?-1:1:r>n?-1:1}function i(e,r){return e=""+e,r.keepDiacritics||(e=t.clean(e)),e}l.rankings=a,l.caseRankings=n;var u=Object.freeze({default:l,rankings:a}),f=l;return Object.assign(f,Object.keys(u).reduce(function(e,t){return"default"!==t&&(e[t]=u[t]),e},{})),f}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.matchSorter=t()}(this,function(){"use strict";var e,t=(function(e){!function(t,r){e.exports?e.exports=r():this.Diacritics=r()}(0,function(){for(var e={map:{}},t=[{base:" ",letters:" "},{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"Th",letters:"Þ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐɑ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"ff",letters:"ff"},{base:"fi",letters:"fi"},{base:"fl",letters:"fl"},{base:"ffi",letters:"ffi"},{base:"ffl",letters:"ffl"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nñnⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥлԉ"},{base:"nj",letters:"nj"},{base:"o",letters:"߀oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oe",letters:"Œœ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"ss",letters:"ß"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"th",letters:"þ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],r=0,s=t.length;r<s;r++)for(var a=t[r].letters.split(""),n=0,l=a.length;n<l;n++)e.map[a[n]]=t[r].base;return e.clean=function(t){if(!t||!t.length||t.length<1)return"";for(var r,s="",a=t.split(""),n=0,l=a.length;n<l;n++)s+=(r=a[n])in e.map?e.map[r]:r;return s},e})}(e={exports:{}},e.exports),e.exports),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},s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},a={CASE_SENSITIVE_EQUAL:9,EQUAL:8,STARTS_WITH:7,WORD_STARTS_WITH:6,STRING_CASE:5,STRING_CASE_ACRONYM:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0},n={CAMEL:.8,PASCAL:.6,KEBAB:.4,SNAKE:.2,NO_CASE:0};function l(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return e;var l=n.keys,i=n.threshold,u=void 0===i?a.MATCHES:i;return e.reduce(function(e,o,i){var f=function(e,t,n,l){if(!t)return{rank:b(e,n,l),keyIndex:-1};return function(e,t){return t.reduce(function(t,a){var n=function(e,t){"object"===(void 0===t?"undefined":r(t))&&(t=t.key);var s=void 0;s="function"==typeof t?t(e):-1!==t.indexOf(".")?t.split(".").reduce(function(e,t){return e?e[t]:null},e):e[t];return null!=s?[].concat(s):null}(e,a);return n&&n.forEach(function(e){t.push({itemValue:e,attributes:function(e){"string"==typeof e&&(e={key:e});return s({maxRanking:1/0,minRanking:-1/0},e)}(a)})}),t},[])}(e,t).reduce(function(e,t,r){var s=e.rank,o=e.keyIndex,i=t.itemValue,u=t.attributes,f=b(i,n,l),c=u.minRanking,A=u.maxRanking;return f<c&&f>=a.MATCHES?f=c:f>A&&(f=A),f>s&&(s=f,o=r),{rank:s,keyIndex:o}},{rank:a.NO_MATCH,keyIndex:-1})}(o,l,t,n),c=f.rank,A=f.keyIndex;return c>=u&&e.push({item:o,rank:c,index:i,keyIndex:A}),e},[]).sort(o).map(function(e){return e.item})}function b(e,t,r){if(e=i(e,r),(t=i(t,r)).length>e.length)return a.NO_MATCH;if(e===t)return a.CASE_SENSITIVE_EQUAL;var s,l,b=function(e){var t=e.toLowerCase()!==e,r=e.indexOf("-")>=0,s=e.indexOf("_")>=0;if(!t&&!s&&r)return n.KEBAB;if(!t&&s&&!r)return n.SNAKE;if(t&&!r&&!s){var a=e[0].toUpperCase()===e[0];return a?n.PASCAL:n.CAMEL}return n.NO_CASE}(e),o=function(e,t,r){var s=e.toLowerCase().indexOf(t.toLowerCase());switch(r){case n.SNAKE:return"_"===e[s-1];case n.KEBAB:return"-"===e[s-1];case n.PASCAL:case n.CAMEL:return-1!==s&&e[s]===e[s].toUpperCase();default:return!1}}(e,t,b),u=function(e,t,r){var s=null;switch(r){case n.SNAKE:s="_";break;case n.KEBAB:s="-";break;case n.PASCAL:case n.CAMEL:s=/(?=[A-Z])/;break;default:s=null}var a=e.split(s);return t.toLowerCase().split("").reduce(function(e,t,r){var s=a[r];return e&&s&&s[0].toLowerCase()===t},!0)}(e,t,b);return(e=e.toLowerCase())===(t=t.toLowerCase())?a.EQUAL+b:0===e.indexOf(t)?a.STARTS_WITH+b:-1!==e.indexOf(" "+t)?a.WORD_STARTS_WITH+b:o?a.STRING_CASE+b:b>0&&u?a.STRING_CASE_ACRONYM+b:-1!==e.indexOf(t)?a.CONTAINS+b:1===t.length?a.NO_MATCH:-1!==(s=e,l="",s.split(" ").forEach(function(e){e.split("-").forEach(function(e){l+=e.substr(0,1)})}),l).indexOf(t)?a.ACRONYM+b:function(e,t){var r=0;function s(e,t,r){for(var s=r;s<t.length;s++){var a=t[s];if(a===e)return s+1}return-1}var n=s(t[0],e,0);if(n<0)return a.NO_MATCH;r=n;for(var l=1;l<t.length;l++){var b=t[l],o=(r=s(b,e,r))>-1;if(!o)return a.NO_MATCH}return function(e){var r=e-t.length+1,s=a.MATCHES+1/r;return s}(r-n)}(e,t)}function o(e,t){var r=e.rank,s=e.index,a=e.keyIndex,n=t.rank,l=t.index,b=t.keyIndex;return r===n?a===b?s<l?-1:1:a<b?-1:1:r>n?-1:1}function i(e,r){return e=""+e,r.keepDiacritics||(e=t.clean(e)),e}l.rankings=a,l.caseRankings=n;var u=Object.freeze({default:l,rankings:a}),f=l;return Object.assign(f,Object.keys(u).reduce(function(e,t){return"default"!==t&&(e[t]=u[t]),e},{})),f}); | ||
//# sourceMappingURL=match-sorter.umd.min.js.map |
{ | ||
"name": "match-sorter", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Simple, expected, and deterministic best-match sorting of an array in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/match-sorter.cjs.js", |
@@ -18,3 +18,3 @@ <div align="center"> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -277,3 +277,3 @@ [![Donate][donate-badge]][donate] | ||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | | ||
| [<img src="https://avatars1.githubusercontent.com/u/2084833?v=4" width="100px;"/><br /><sub><b>Hozefa</b></sub>](https://github.com/hozefaj)<br />[🐛](https://github.com/kentcdodds/match-sorter/issues?q=author%3Ahozefaj "Bug reports") [💻](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Code") [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Tests") [🤔](#ideas-hozefaj "Ideas, Planning, & Feedback") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/2084833?v=4" width="100px;"/><br /><sub><b>Hozefa</b></sub>](https://github.com/hozefaj)<br />[🐛](https://github.com/kentcdodds/match-sorter/issues?q=author%3Ahozefaj "Bug reports") [💻](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Code") [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=hozefaj "Tests") [🤔](#ideas-hozefaj "Ideas, Planning, & Feedback") | [<img src="https://avatars3.githubusercontent.com/u/9403361?v=4" width="100px;"/><br /><sub><b>pushpinder107</b></sub>](https://github.com/pushpinder107)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=pushpinder107 "Code") | | ||
@@ -280,0 +280,0 @@ <!-- ALL-CONTRIBUTORS-LIST:END --> |
Sorry, the diff of this file is not supported yet
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
191429
1919