match-sorter
Advanced tools
Comparing version 1.6.0 to 1.7.0
'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /** | ||
* @name match-sorter | ||
* @license MIT license. | ||
* @copyright (c) 2016 Kent C. Dodds | ||
* @author Kent C. Dodds <kent@doddsfamily.us> | ||
*/ | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** | ||
* @name match-sorter | ||
* @license MIT license. | ||
* @copyright (c) 2016 Kent C. Dodds | ||
* @author Kent C. Dodds <kent@doddsfamily.us> | ||
*/ | ||
var _diacritic = require('diacritic'); | ||
@@ -42,6 +44,6 @@ | ||
function matchSorter(items, value) { | ||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var keys = options.keys; | ||
var _options$threshold = options.threshold; | ||
var threshold = _options$threshold === undefined ? rankings.MATCHES : _options$threshold; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var keys = options.keys, | ||
_options$threshold = options.threshold, | ||
threshold = _options$threshold === undefined ? rankings.MATCHES : _options$threshold; | ||
@@ -55,7 +57,6 @@ var matchedItems = items.reduce(reduceItemsToRanked, []); | ||
function reduceItemsToRanked(matches, item, index) { | ||
var _getHighestRanking = getHighestRanking(item, keys, value, options); | ||
var _getHighestRanking = getHighestRanking(item, keys, value, options), | ||
rank = _getHighestRanking.rank, | ||
keyIndex = _getHighestRanking.keyIndex; | ||
var rank = _getHighestRanking.rank; | ||
var keyIndex = _getHighestRanking.keyIndex; | ||
if (rank >= threshold) { | ||
@@ -81,5 +82,7 @@ matches.push({ item: item, rank: rank, index: index, keyIndex: keyIndex }); | ||
var valuesToRank = getAllValuesToRank(item, keys); | ||
return valuesToRank.reduce(function (_ref2, itemValue, i) { | ||
var rank = _ref2.rank; | ||
var keyIndex = _ref2.keyIndex; | ||
return valuesToRank.reduce(function (_ref2, _ref3, i) { | ||
var rank = _ref2.rank, | ||
keyIndex = _ref2.keyIndex; | ||
var itemValue = _ref3.itemValue, | ||
attributes = _ref3.attributes; | ||
@@ -91,2 +94,10 @@ var newRank = getMatchRanking(itemValue, value, options); | ||
} | ||
var minRanking = attributes.minRanking, | ||
maxRanking = attributes.maxRanking; | ||
if (rank < minRanking && newRank >= rankings.MATCHES) { | ||
rank = minRanking; | ||
} else if (rank > maxRanking) { | ||
rank = maxRanking; | ||
} | ||
return { rank: rank, keyIndex: keyIndex }; | ||
@@ -217,8 +228,8 @@ }, { rank: rankings.NO_MATCH, keyIndex: -1 }); | ||
var bFirst = 1; | ||
var aRank = a.rank; | ||
var aIndex = a.index; | ||
var aKeyIndex = a.keyIndex; | ||
var bRank = b.rank; | ||
var bIndex = b.index; | ||
var bKeyIndex = b.keyIndex; | ||
var aRank = a.rank, | ||
aIndex = a.index, | ||
aKeyIndex = a.keyIndex; | ||
var bRank = b.rank, | ||
bIndex = b.index, | ||
bKeyIndex = b.keyIndex; | ||
@@ -243,4 +254,4 @@ var same = aRank === bRank; | ||
*/ | ||
function prepareValueForComparison(value, _ref3) { | ||
var keepDiacritics = _ref3.keepDiacritics; | ||
function prepareValueForComparison(value, _ref4) { | ||
var keepDiacritics = _ref4.keepDiacritics; | ||
@@ -258,15 +269,22 @@ value = '' + value; // toString | ||
* @param {Object|Function} key - the potentially nested keypath or property callback | ||
* @return {String} - the value at nested keypath | ||
* @return {Array} - an array containing the value(s) at the nested keypath | ||
*/ | ||
function getItemValue(item, key) { | ||
function getItemValues(item, key) { | ||
if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { | ||
key = key.key; | ||
} | ||
var value = void 0; | ||
if (typeof key === 'function') { | ||
return key(item); | ||
value = key(item); | ||
} else if (key.indexOf('.') !== -1) { | ||
// eslint-disable-line no-negated-condition | ||
// handle nested keys | ||
value = key.split('.').reduce(function (itemObj, nestedKey) { | ||
return itemObj[nestedKey]; | ||
}, item); | ||
} else { | ||
value = item[key]; | ||
} | ||
var isNested = key.indexOf('.') !== -1; | ||
if (!isNested) { | ||
return item[key]; | ||
} | ||
return key.split('.').reduce(function (itemObj, nestedKey) { | ||
return itemObj[nestedKey]; | ||
}, item); | ||
// concat because `value` can be a string or an array | ||
return value ? [].concat(value) : null; | ||
} | ||
@@ -278,10 +296,34 @@ | ||
* @param {Array} keys - the keys to use to retrieve the values | ||
* @return {Array} the values in an array | ||
* @return {Array} objects with {itemValue, attributes} | ||
*/ | ||
function getAllValuesToRank(item, keys) { | ||
return keys.reduce(function (allVals, key) { | ||
return allVals.concat(getItemValue(item, key)); | ||
var values = getItemValues(item, key); | ||
if (values) { | ||
values.forEach(function (itemValue) { | ||
allVals.push({ | ||
itemValue: itemValue, | ||
attributes: getKeyAttributes(key) | ||
}); | ||
}); | ||
} | ||
return allVals; | ||
}, []); | ||
} | ||
/** | ||
* Gets all the attributes for the given key | ||
* @param {Object|String} key - the key from which the attributes will be retrieved | ||
* @return {Object} object containing the key's attributes | ||
*/ | ||
function getKeyAttributes(key) { | ||
if (typeof key === 'string') { | ||
key = { key: key }; | ||
} | ||
return _extends({ | ||
maxRanking: Infinity, | ||
minRanking: -Infinity | ||
}, key); | ||
} | ||
// some manual ✨ magic umd ✨ here because Rollup isn't capable of exposing our module the way we want | ||
@@ -288,0 +330,0 @@ // see dist-test/index.js |
@@ -1,7 +0,7 @@ | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {} | ||
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function interopDefault(ex) { | ||
return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex; | ||
} | ||
function createCommonjsModule(fn, module) { | ||
@@ -21,5 +21,5 @@ return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
(function (name, definition) { | ||
if (typeof module != 'undefined' && module.exports) module.exports = definition() | ||
else if (typeof define == 'function' && define.amd) define(definition) | ||
else this[name] = definition() | ||
if ('object' != 'undefined' && module.exports) module.exports = definition(); | ||
else if (typeof undefined == 'function' && undefined.amd) undefined(definition); | ||
else this[name] = definition(); | ||
})('Diacritics', function () { | ||
@@ -167,11 +167,9 @@ // Create public object | ||
var diacritics$1 = interopDefault(diacritics); | ||
var globalObject = createCommonjsModule(function (module) { | ||
(function($){try{$('export default global')}catch(e){try{$('export default self')}catch(e){try{module.exports=commonjsGlobal}catch(e){try{self.global=self}catch(e){window.global=window}}}}}(eval)) | ||
(function($){try{$('export default global');}catch(e){try{$('export default self');}catch(e){try{module.exports=commonjsGlobal;}catch(e){try{self.global=self;}catch(e){window.global=window;}}}}}(eval)); | ||
}); | ||
var globalObject$1 = interopDefault(globalObject); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -205,6 +203,6 @@ /** | ||
function matchSorter(items, value) { | ||
var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
var keys = options.keys; | ||
var _options$threshold = options.threshold; | ||
var threshold = _options$threshold === undefined ? rankings.MATCHES : _options$threshold; | ||
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
var keys = options.keys, | ||
_options$threshold = options.threshold, | ||
threshold = _options$threshold === undefined ? rankings.MATCHES : _options$threshold; | ||
@@ -218,7 +216,6 @@ var matchedItems = items.reduce(reduceItemsToRanked, []); | ||
function reduceItemsToRanked(matches, item, index) { | ||
var _getHighestRanking = getHighestRanking(item, keys, value, options); | ||
var _getHighestRanking = getHighestRanking(item, keys, value, options), | ||
rank = _getHighestRanking.rank, | ||
keyIndex = _getHighestRanking.keyIndex; | ||
var rank = _getHighestRanking.rank; | ||
var keyIndex = _getHighestRanking.keyIndex; | ||
if (rank >= threshold) { | ||
@@ -244,5 +241,7 @@ matches.push({ item: item, rank: rank, index: index, keyIndex: keyIndex }); | ||
var valuesToRank = getAllValuesToRank(item, keys); | ||
return valuesToRank.reduce(function (_ref2, itemValue, i) { | ||
var rank = _ref2.rank; | ||
var keyIndex = _ref2.keyIndex; | ||
return valuesToRank.reduce(function (_ref2, _ref3, i) { | ||
var rank = _ref2.rank, | ||
keyIndex = _ref2.keyIndex; | ||
var itemValue = _ref3.itemValue, | ||
attributes = _ref3.attributes; | ||
@@ -254,2 +253,10 @@ var newRank = getMatchRanking(itemValue, value, options); | ||
} | ||
var minRanking = attributes.minRanking, | ||
maxRanking = attributes.maxRanking; | ||
if (rank < minRanking && newRank >= rankings.MATCHES) { | ||
rank = minRanking; | ||
} else if (rank > maxRanking) { | ||
rank = maxRanking; | ||
} | ||
return { rank: rank, keyIndex: keyIndex }; | ||
@@ -380,8 +387,8 @@ }, { rank: rankings.NO_MATCH, keyIndex: -1 }); | ||
var bFirst = 1; | ||
var aRank = a.rank; | ||
var aIndex = a.index; | ||
var aKeyIndex = a.keyIndex; | ||
var bRank = b.rank; | ||
var bIndex = b.index; | ||
var bKeyIndex = b.keyIndex; | ||
var aRank = a.rank, | ||
aIndex = a.index, | ||
aKeyIndex = a.keyIndex; | ||
var bRank = b.rank, | ||
bIndex = b.index, | ||
bKeyIndex = b.keyIndex; | ||
@@ -406,8 +413,8 @@ var same = aRank === bRank; | ||
*/ | ||
function prepareValueForComparison(value, _ref3) { | ||
var keepDiacritics = _ref3.keepDiacritics; | ||
function prepareValueForComparison(value, _ref4) { | ||
var keepDiacritics = _ref4.keepDiacritics; | ||
value = '' + value; // toString | ||
if (!keepDiacritics) { | ||
value = diacritics$1.clean(value); | ||
value = diacritics.clean(value); | ||
} | ||
@@ -421,15 +428,22 @@ return value; | ||
* @param {Object|Function} key - the potentially nested keypath or property callback | ||
* @return {String} - the value at nested keypath | ||
* @return {Array} - an array containing the value(s) at the nested keypath | ||
*/ | ||
function getItemValue(item, key) { | ||
function getItemValues(item, key) { | ||
if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { | ||
key = key.key; | ||
} | ||
var value = void 0; | ||
if (typeof key === 'function') { | ||
return key(item); | ||
value = key(item); | ||
} else if (key.indexOf('.') !== -1) { | ||
// eslint-disable-line no-negated-condition | ||
// handle nested keys | ||
value = key.split('.').reduce(function (itemObj, nestedKey) { | ||
return itemObj[nestedKey]; | ||
}, item); | ||
} else { | ||
value = item[key]; | ||
} | ||
var isNested = key.indexOf('.') !== -1; | ||
if (!isNested) { | ||
return item[key]; | ||
} | ||
return key.split('.').reduce(function (itemObj, nestedKey) { | ||
return itemObj[nestedKey]; | ||
}, item); | ||
// concat because `value` can be a string or an array | ||
return value ? [].concat(value) : null; | ||
} | ||
@@ -441,10 +455,34 @@ | ||
* @param {Array} keys - the keys to use to retrieve the values | ||
* @return {Array} the values in an array | ||
* @return {Array} objects with {itemValue, attributes} | ||
*/ | ||
function getAllValuesToRank(item, keys) { | ||
return keys.reduce(function (allVals, key) { | ||
return allVals.concat(getItemValue(item, key)); | ||
var values = getItemValues(item, key); | ||
if (values) { | ||
values.forEach(function (itemValue) { | ||
allVals.push({ | ||
itemValue: itemValue, | ||
attributes: getKeyAttributes(key) | ||
}); | ||
}); | ||
} | ||
return allVals; | ||
}, []); | ||
} | ||
/** | ||
* Gets all the attributes for the given key | ||
* @param {Object|String} key - the key from which the attributes will be retrieved | ||
* @return {Object} object containing the key's attributes | ||
*/ | ||
function getKeyAttributes(key) { | ||
if (typeof key === 'string') { | ||
key = { key: key }; | ||
} | ||
return _extends({ | ||
maxRanking: Infinity, | ||
minRanking: -Infinity | ||
}, key); | ||
} | ||
// some manual ✨ magic umd ✨ here because Rollup isn't capable of exposing our module the way we want | ||
@@ -463,3 +501,3 @@ // see dist-test/index.js | ||
} else { | ||
globalObject$1.matchSorter = matchSorter; // eslint-disable-line | ||
} | ||
globalObject.matchSorter = matchSorter; // eslint-disable-line | ||
} |
@@ -1,2 +0,2 @@ | ||
function interopDefault(e){return e&&"object"==typeof e&&"default"in e?e["default"]:e}function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}function matchSorter(e,t){function r(e,r,n){var o=getHighestRanking(r,a,t,s),i=o.rank,b=o.keyIndex;return i>=l&&e.push({item:r,rank:i,index:n,keyIndex:b}),e}var s=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],a=s.keys,n=s.threshold,l=void 0===n?rankings.MATCHES:n,o=e.reduce(r,[]);return o.sort(sortRankedItems).map(function(e){var t=e.item;return t})}function getHighestRanking(e,t,r,s){if(!t)return{rank:getMatchRanking(e,r,s),keyIndex:-1};var a=getAllValuesToRank(e,t);return a.reduce(function(e,t,a){var n=e.rank,l=e.keyIndex,o=getMatchRanking(t,r,s);return o>n&&(n=o,l=a),{rank:n,keyIndex:l}},{rank:rankings.NO_MATCH,keyIndex:-1})}function getMatchRanking(e,t,r){return e=prepareValueForComparison(e,r),t=prepareValueForComparison(t,r),t.length>e.length?rankings.NO_MATCH:e===t?rankings.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?rankings.EQUAL:0===e.indexOf(t)?rankings.STARTS_WITH:e.indexOf(" "+t)!==-1?rankings.WORD_STARTS_WITH:e.indexOf(t)!==-1?rankings.CONTAINS:1===t.length?rankings.NO_MATCH:getAcronym(e).indexOf(t)!==-1?rankings.ACRONYM:stringsByCharOrder(e,t))}function getAcronym(e){var t="",r=e.split(" ");return r.forEach(function(e){var r=e.split("-");r.forEach(function(e){t+=e.substr(0,1)})}),t}function stringsByCharOrder(e,t){function r(e,t){for(var r=!1,a=s;a<t.length;a++){var n=t[a];if(n===e){r=!0,s=a+1;break}}return r}for(var s=0,a=0;a<t.length;a++){var n=t[a],l=r(n,e);if(!l)return rankings.NO_MATCH}return rankings.MATCHES}function sortRankedItems(e,t){var r=-1,s=1,a=e.rank,n=e.index,l=e.keyIndex,o=t.rank,i=t.index,b=t.keyIndex,f=a===o;return f?l===b?n<i?r:s:l<b?r:s:a>o?r:s}function prepareValueForComparison(e,t){var r=t.keepDiacritics;return e=""+e,r||(e=diacritics$1.clean(e)),e}function getItemValue(e,t){if("function"==typeof t)return t(e);var r=t.indexOf(".")!==-1;return r?t.split(".").reduce(function(e,t){return e[t]},e):e[t]}function getAllValuesToRank(e,t){return t.reduce(function(t,r){return t.concat(getItemValue(e,r))},[])}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},diacritics=createCommonjsModule(function(e){!function(t,r){"undefined"!=typeof e&&e.exports?e.exports=r():"function"==typeof define&&define.amd?define(r):this[t]=r()}("Diacritics",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++)r=a[n],s+=r in e.map?e.map[r]:r;return s},e})}),diacritics$1=interopDefault(diacritics),globalObject=createCommonjsModule(function(module){!function(e){try{e("export default global")}catch(t){try{e("export default self")}catch(t){try{module.exports=commonjsGlobal}catch(t){try{self.global=self}catch(t){window.global=window}}}}}(eval)}),globalObject$1=interopDefault(globalObject),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},rankings={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};matchSorter.rankings=rankings,"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?(matchSorter["default"]=matchSorter,module.exports=matchSorter,Object.defineProperty(exports,"__esModule",{value:!0})):"function"==typeof define&&define.amd?define(function(){return matchSorter}):globalObject$1.matchSorter=matchSorter; | ||
function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}function matchSorter(e,t){function r(e,r,n){var o=getHighestRanking(r,a,t,s),i=o.rank,b=o.keyIndex;return i>=l&&e.push({item:r,rank:i,index:n,keyIndex:b}),e}var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=s.keys,n=s.threshold,l=void 0===n?rankings.MATCHES:n,o=e.reduce(r,[]);return o.sort(sortRankedItems).map(function(e){var t=e.item;return t})}function getHighestRanking(e,t,r,s){if(!t)return{rank:getMatchRanking(e,r,s),keyIndex:-1};var a=getAllValuesToRank(e,t);return a.reduce(function(e,t,a){var n=e.rank,l=e.keyIndex,o=t.itemValue,i=t.attributes,b=getMatchRanking(o,r,s);b>n&&(n=b,l=a);var u=i.minRanking,f=i.maxRanking;return n<u&&b>=rankings.MATCHES?n=u:n>f&&(n=f),{rank:n,keyIndex:l}},{rank:rankings.NO_MATCH,keyIndex:-1})}function getMatchRanking(e,t,r){return e=prepareValueForComparison(e,r),t=prepareValueForComparison(t,r),t.length>e.length?rankings.NO_MATCH:e===t?rankings.CASE_SENSITIVE_EQUAL:(e=e.toLowerCase(),t=t.toLowerCase(),e===t?rankings.EQUAL:0===e.indexOf(t)?rankings.STARTS_WITH:e.indexOf(" "+t)!==-1?rankings.WORD_STARTS_WITH:e.indexOf(t)!==-1?rankings.CONTAINS:1===t.length?rankings.NO_MATCH:getAcronym(e).indexOf(t)!==-1?rankings.ACRONYM:stringsByCharOrder(e,t))}function getAcronym(e){var t="",r=e.split(" ");return r.forEach(function(e){var r=e.split("-");r.forEach(function(e){t+=e.substr(0,1)})}),t}function stringsByCharOrder(e,t){function r(e,t){for(var r=!1,a=s;a<t.length;a++){var n=t[a];if(n===e){r=!0,s=a+1;break}}return r}for(var s=0,a=0;a<t.length;a++){var n=t[a],l=r(n,e);if(!l)return rankings.NO_MATCH}return rankings.MATCHES}function sortRankedItems(e,t){var r=-1,s=1,a=e.rank,n=e.index,l=e.keyIndex,o=t.rank,i=t.index,b=t.keyIndex,u=a===o;return u?l===b?n<i?r:s:l<b?r:s:a>o?r:s}function prepareValueForComparison(e,t){var r=t.keepDiacritics;return e=""+e,r||(e=diacritics.clean(e)),e}function getItemValues(e,t){"object"===("undefined"==typeof t?"undefined":_typeof(t))&&(t=t.key);var r=void 0;return r="function"==typeof t?t(e):t.indexOf(".")!==-1?t.split(".").reduce(function(e,t){return e[t]},e):e[t],r?[].concat(r):null}function getAllValuesToRank(e,t){return t.reduce(function(t,r){var s=getItemValues(e,r);return s&&s.forEach(function(e){t.push({itemValue:e,attributes:getKeyAttributes(r)})}),t},[])}function getKeyAttributes(e){return"string"==typeof e&&(e={key:e}),_extends({maxRanking:1/0,minRanking:-(1/0)},e)}var commonjsGlobal="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},diacritics=createCommonjsModule(function(e){!function(t,r){e.exports?e.exports=r():this[t]=r()}("Diacritics",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++)r=a[n],s+=r in e.map?e.map[r]:r;return s},e})}),globalObject=createCommonjsModule(function(module){!function(e){try{e("export default global")}catch(t){try{e("export default self")}catch(e){try{module.exports=commonjsGlobal}catch(e){try{self.global=self}catch(e){window.global=window}}}}}(eval)}),_extends=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},_typeof="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},rankings={CASE_SENSITIVE_EQUAL:7,EQUAL:6,STARTS_WITH:5,WORD_STARTS_WITH:4,CONTAINS:3,ACRONYM:2,MATCHES:1,NO_MATCH:0};matchSorter.rankings=rankings,"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?(matchSorter.default=matchSorter,module.exports=matchSorter,Object.defineProperty(exports,"__esModule",{value:!0})):"function"==typeof define&&define.amd?define(function(){return matchSorter}):globalObject.matchSorter=matchSorter; | ||
//# sourceMappingURL=match-sorter.min.js.map |
{ | ||
"_args": [ | ||
[ | ||
{ | ||
"raw": "diacritic@0.0.2", | ||
"scope": null, | ||
"escapedName": "diacritic", | ||
"name": "diacritic", | ||
"rawSpec": "0.0.2", | ||
"spec": "0.0.2", | ||
"type": "version" | ||
}, | ||
"/home/travis/build/kentcdodds/match-sorter" | ||
] | ||
], | ||
"_from": "diacritic@0.0.2", | ||
"_id": "diacritic@0.0.2", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/diacritic", | ||
"_npmUser": { | ||
"name": "nijikokun", | ||
"email": "nijikokun@gmail.com" | ||
"name": "diacritic", | ||
"version": "0.0.2", | ||
"description": "Removes accents / diacritics from strings, sentences, and paragraphs fast and effeciently.", | ||
"main": "diacritics.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"_npmVersion": "1.3.5", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"raw": "diacritic@0.0.2", | ||
"scope": null, | ||
"escapedName": "diacritic", | ||
"name": "diacritic", | ||
"rawSpec": "0.0.2", | ||
"spec": "0.0.2", | ||
"type": "version" | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:Nijikokun/Diacritics.js.git" | ||
}, | ||
"_requiredBy": [ | ||
"/" | ||
], | ||
"_resolved": "http://registry.npmjs.org/diacritic/-/diacritic-0.0.2.tgz", | ||
"_shasum": "fc2a887b5a5bc0a0a854fb614c7c2f209061ee04", | ||
"_shrinkwrap": null, | ||
"_spec": "diacritic@0.0.2", | ||
"_where": "/home/travis/build/kentcdodds/match-sorter", | ||
"author": { | ||
"name": "Nijiko Yonskai" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Nijikokun/Diacritics.js/issues" | ||
}, | ||
"dependencies": {}, | ||
"description": "Removes accents / diacritics from strings, sentences, and paragraphs fast and effeciently.", | ||
"devDependencies": {}, | ||
"directories": {}, | ||
"dist": { | ||
"shasum": "fc2a887b5a5bc0a0a854fb614c7c2f209061ee04", | ||
"tarball": "https://registry.npmjs.org/diacritic/-/diacritic-0.0.2.tgz" | ||
}, | ||
"homepage": "https://github.com/Nijikokun/Diacritics.js#readme", | ||
"keywords": [ | ||
@@ -70,21 +24,5 @@ "diacritics", | ||
], | ||
"author": "Nijiko Yonskai", | ||
"license": "MIT", | ||
"main": "diacritics.js", | ||
"maintainers": [ | ||
{ | ||
"name": "nijikokun", | ||
"email": "nijikokun@gmail.com" | ||
} | ||
], | ||
"name": "diacritic", | ||
"optionalDependencies": {}, | ||
"readme": "ERROR: No README data found!", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@github.com/Nijikokun/Diacritics.js.git" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "0.0.2" | ||
"readmeFilename": "README.md" | ||
} |
{ | ||
"_args": [ | ||
[ | ||
{ | ||
"raw": "global-object@1.0.0", | ||
"scope": null, | ||
"escapedName": "global-object", | ||
"name": "global-object", | ||
"rawSpec": "1.0.0", | ||
"spec": "1.0.0", | ||
"type": "version" | ||
}, | ||
"/home/travis/build/kentcdodds/match-sorter" | ||
] | ||
], | ||
"_from": "global-object@1.0.0", | ||
"_id": "global-object@1.0.0", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/global-object", | ||
"_nodeVersion": "1.4.1", | ||
"_npmUser": { | ||
"name": "webreflection", | ||
"email": "andrea.giammarchi@gmail.com" | ||
"name": "global-object", | ||
"version": "1.0.0", | ||
"description": "just the global object", | ||
"main": "global-object.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"_npmVersion": "2.6.0", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"raw": "global-object@1.0.0", | ||
"scope": null, | ||
"escapedName": "global-object", | ||
"name": "global-object", | ||
"rawSpec": "1.0.0", | ||
"spec": "1.0.0", | ||
"type": "version" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/WebReflection/global-object.git" | ||
}, | ||
"_requiredBy": [ | ||
"/" | ||
], | ||
"_resolved": "http://registry.npmjs.org/global-object/-/global-object-1.0.0.tgz", | ||
"_shasum": "2a1b45e901d55e4773154f12f0cec1ef9aba5f9f", | ||
"_shrinkwrap": null, | ||
"_spec": "global-object@1.0.0", | ||
"_where": "/home/travis/build/kentcdodds/match-sorter", | ||
"author": { | ||
"name": "Andrea Giammarchi" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/WebReflection/global-object/issues" | ||
}, | ||
"dependencies": {}, | ||
"description": "just the global object", | ||
"devDependencies": {}, | ||
"directories": {}, | ||
"dist": { | ||
"shasum": "2a1b45e901d55e4773154f12f0cec1ef9aba5f9f", | ||
"tarball": "https://registry.npmjs.org/global-object/-/global-object-1.0.0.tgz" | ||
}, | ||
"gitHead": "7590925460677e5fcf05de3092e34732c0523848", | ||
"homepage": "https://github.com/WebReflection/global-object", | ||
"keywords": [ | ||
"global" | ||
], | ||
"author": "Andrea Giammarchi", | ||
"license": "WTFPL", | ||
"main": "global-object.js", | ||
"maintainers": [ | ||
{ | ||
"name": "webreflection", | ||
"email": "andrea.giammarchi@gmail.com" | ||
} | ||
], | ||
"name": "global-object", | ||
"optionalDependencies": {}, | ||
"readme": "ERROR: No README data found!", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/WebReflection/global-object.git" | ||
"bugs": { | ||
"url": "https://github.com/WebReflection/global-object/issues" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "1.0.0" | ||
"homepage": "https://github.com/WebReflection/global-object" | ||
} |
{ | ||
"name": "match-sorter", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Simple, expected, and deterministic best-match sorting of an array in JavaScript", | ||
"main": "dist/cjs/index.js", | ||
"scripts": { | ||
"start": "package-scripts", | ||
"test": "package-scripts test", | ||
"start": "nps", | ||
"test": "nps test", | ||
"commitmsg": "opt --in commit-msg --exec \"validate-commit-msg\"", | ||
@@ -27,26 +27,27 @@ "precommit": "opt --in pre-commit --exec \"npm start validate\"" | ||
"devDependencies": { | ||
"all-contributors-cli": "^3.0.0", | ||
"babel-cli": "^6.7.7", | ||
"babel-jest": "15.0.0", | ||
"babel-polyfill": "6.13.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-2": "^6.5.0", | ||
"all-contributors-cli": "^4.0.1", | ||
"babel-cli": "^6.23.0", | ||
"babel-jest": "^19.0.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babel-preset-stage-2": "^6.22.0", | ||
"codecov": "^1.0.1", | ||
"commitizen": "^2.8.6", | ||
"cz-conventional-changelog": "^1.2.0", | ||
"eslint": "^3.1.1", | ||
"eslint-config-kentcdodds": "^10.1.0", | ||
"husky": "0.11.7", | ||
"jest-cli": "15.1.0", | ||
"nodemon": "1.10.2", | ||
"commitizen": "^2.9.6", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"eslint": "^3.16.1", | ||
"eslint-config-kentcdodds": "^12.0.0", | ||
"husky": "^0.13.2", | ||
"jest-cli": "^19.0.2", | ||
"nodemon": "^1.11.0", | ||
"nps": "^5.0.3", | ||
"nps-utils": "^1.1.2", | ||
"opt-cli": "^1.4.2", | ||
"p-s": "^2.3.0", | ||
"rimraf": "^2.5.4", | ||
"rollup": "0.34.10", | ||
"rollup-plugin-babel": "2.6.1", | ||
"rollup-plugin-commonjs": "3.3.1", | ||
"rollup-plugin-node-resolve": "2.0.0", | ||
"rollup-plugin-uglify": "1.0.1", | ||
"semantic-release": "^4.3.5", | ||
"validate-commit-msg": "^2.8.0" | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.41.4", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"rollup-plugin-commonjs": "^7.0.0", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"rollup-plugin-uglify": "^1.0.1", | ||
"semantic-release": "^6.3.2", | ||
"validate-commit-msg": "^2.11.1" | ||
}, | ||
@@ -53,0 +54,0 @@ "eslintConfig": { |
@@ -12,3 +12,3 @@ # match-sorter | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors) | ||
[![PRs Welcome][prs-badge]][prs] | ||
@@ -130,2 +130,28 @@ [![Donate][donate-badge]][donate] | ||
__Min and Max Ranking__: You may restrict specific keys to a minimum or maximum ranking by passing in an object. A key with a minimum rank will only get promoted if there is at least a simple match. | ||
```javascript | ||
const tea = [ | ||
{tea: 'Earl Grey', alias: 'A'}, | ||
{tea: 'Assam', alias: 'B'}, | ||
{tea: 'Black', alias: 'C'}, | ||
] | ||
matchSorter(tea, 'A', {keys: ['tea', {maxRanking: matchSorter.rankings.STARTS_WITH, key: 'alias'}]}) | ||
// without maxRanking, Earl Grey would come first because the alias "A" would be CASE_SENSITIVE_EQUAL | ||
// `tea` key comes before `alias` key, so Assam comes first even though both match as STARTS_WITH | ||
// [{tea: 'Assam', alias: 'B'}, {tea: 'Earl Grey', alias: 'A'},{tea: 'Black', alias: 'C'}] | ||
``` | ||
```javascript | ||
const tea = [ | ||
{tea: 'Milk', alias: 'moo'}, | ||
{tea: 'Oolong', alias: 'B'}, | ||
{tea: 'Green', alias: 'C'}, | ||
] | ||
matchSorter(tea, 'oo', {keys: ['tea', {minRanking: matchSorter.rankings.EQUAL, key: 'alias'}]}) | ||
// minRanking bumps Milk up to EQUAL from CONTAINS (alias) | ||
// Oolong matches as STARTS_WITH | ||
// Green is missing due to no match | ||
// [{tea: 'Milk', alias: 'moo'}, {tea: 'Oolong', alias: 'B'}] | ||
``` | ||
### threshold: `number` | ||
@@ -200,4 +226,4 @@ | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) 👀 | [<img src="https://avatars.githubusercontent.com/u/8263298?v=3" width="100px;"/><br /><sub>Conor Hastings</sub>](http://conorhastings.com)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) [📖](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) 👀 | [<img src="https://avatars.githubusercontent.com/u/574806?v=3" width="100px;"/><br /><sub>Rogelio Guzman</sub>](https://github.com/rogeliog)<br />[📖](https://github.com/kentcdodds/match-sorter/commits?author=rogeliog) | [<img src="https://avatars.githubusercontent.com/u/1416436?v=3" width="100px;"/><br /><sub>Claudéric Demers</sub>](http://ced.io)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) [📖](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) | | ||
| :---: | :---: | :---: | :---: | | ||
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds) 👀 | [<img src="https://avatars.githubusercontent.com/u/8263298?v=3" width="100px;"/><br /><sub>Conor Hastings</sub>](http://conorhastings.com)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) [📖](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=conorhastings) 👀 | [<img src="https://avatars.githubusercontent.com/u/574806?v=3" width="100px;"/><br /><sub>Rogelio Guzman</sub>](https://github.com/rogeliog)<br />[📖](https://github.com/kentcdodds/match-sorter/commits?author=rogeliog) | [<img src="https://avatars.githubusercontent.com/u/1416436?v=3" width="100px;"/><br /><sub>Claudéric Demers</sub>](http://ced.io)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) [📖](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=clauderic) | [<img src="https://avatars1.githubusercontent.com/u/19157735?v=3" width="100px;"/><br /><sub>Denver Chen</sub>](https://github.com/nfdjps)<br />[💻](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps) [📖](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps) [⚠️](https://github.com/kentcdodds/match-sorter/commits?author=nfdjps) | | ||
| :---: | :---: | :---: | :---: | :---: | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -204,0 +230,0 @@ |
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
100782
947
267
25