Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/resources/agGrid/match-sorter.zip
Назад
PK k�}[1�P�: �: dist/match-sorter.cjs.jsnu �Iw�� 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _extends = require('@babel/runtime/helpers/extends'); var removeAccents = require('remove-accents'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends); var removeAccents__default = /*#__PURE__*/_interopDefaultLegacy(removeAccents); var rankings = { 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 }; var caseRankings = { CAMEL: 0.8, PASCAL: 0.6, KEBAB: 0.4, SNAKE: 0.2, NO_CASE: 0 }; matchSorter.rankings = rankings; matchSorter.caseRankings = caseRankings; var defaultBaseSortFn = function (a, b) { return String(a.rankedItem).localeCompare(b.rankedItem); }; /** * Takes an array of items and a value and returns a new array with the items that match the given value * @param {Array} items - the items to sort * @param {String} value - the value to use for ranking * @param {Object} options - Some options to configure the sorter * @return {Array} - the new sorted array */ function matchSorter(items, value, options) { if (options === void 0) { options = {}; } var _options = options, keys = _options.keys, _options$threshold = _options.threshold, threshold = _options$threshold === void 0 ? rankings.MATCHES : _options$threshold, _options$baseSort = _options.baseSort, baseSort = _options$baseSort === void 0 ? defaultBaseSortFn : _options$baseSort; var matchedItems = items.reduce(reduceItemsToRanked, []); return matchedItems.sort(function (a, b) { return sortRankedItems(a, b, baseSort); }).map(function (_ref) { var item = _ref.item; return item; }); function reduceItemsToRanked(matches, item, index) { var _getHighestRanking = getHighestRanking(item, keys, value, options), rankedItem = _getHighestRanking.rankedItem, rank = _getHighestRanking.rank, keyIndex = _getHighestRanking.keyIndex, _getHighestRanking$ke = _getHighestRanking.keyThreshold, keyThreshold = _getHighestRanking$ke === void 0 ? threshold : _getHighestRanking$ke; if (rank >= keyThreshold) { matches.push({ rankedItem: rankedItem, item: item, rank: rank, index: index, keyIndex: keyIndex }); } return matches; } } /** * Gets the highest ranking for value for the given item based on its values for the given keys * @param {*} item - the item to rank * @param {Array} keys - the keys to get values from the item for the ranking * @param {String} value - the value to rank against * @param {Object} options - options to control the ranking * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking */ function getHighestRanking(item, keys, value, options) { if (!keys) { return { // ends up being duplicate of 'item' in matches but consistent rankedItem: item, rank: getMatchRanking(item, value, options), keyIndex: -1, keyThreshold: options.threshold }; } var valuesToRank = getAllValuesToRank(item, keys); return valuesToRank.reduce(function (_ref2, _ref3, i) { var rank = _ref2.rank, rankedItem = _ref2.rankedItem, keyIndex = _ref2.keyIndex, keyThreshold = _ref2.keyThreshold; var itemValue = _ref3.itemValue, attributes = _ref3.attributes; var newRank = getMatchRanking(itemValue, value, options); var newRankedItem = rankedItem; var minRanking = attributes.minRanking, maxRanking = attributes.maxRanking, threshold = attributes.threshold; if (newRank < minRanking && newRank >= rankings.MATCHES) { newRank = minRanking; } else if (newRank > maxRanking) { newRank = maxRanking; } if (newRank > rank) { rank = newRank; keyIndex = i; keyThreshold = threshold; newRankedItem = itemValue; } return { rankedItem: newRankedItem, rank: rank, keyIndex: keyIndex, keyThreshold: keyThreshold }; }, { rank: rankings.NO_MATCH, keyIndex: -1, keyThreshold: options.threshold }); } /** * Gives a rankings score based on how well the two strings match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Object} options - options for the match (like keepDiacritics for comparison) * @returns {Number} the ranking for how well stringToRank matches testString */ function getMatchRanking(testString, stringToRank, options) { /* eslint complexity:[2, 12] */ testString = prepareValueForComparison(testString, options); stringToRank = prepareValueForComparison(stringToRank, options); // too long if (stringToRank.length > testString.length) { return rankings.NO_MATCH; } // case sensitive equals if (testString === stringToRank) { return rankings.CASE_SENSITIVE_EQUAL; } var caseRank = getCaseRanking(testString); var isPartial = isPartialOfCase(testString, stringToRank, caseRank); var isCasedAcronym = isCaseAcronym(testString, stringToRank, caseRank); // Lower casing before further comparison testString = testString.toLowerCase(); stringToRank = stringToRank.toLowerCase(); // case insensitive equals if (testString === stringToRank) { return rankings.EQUAL + caseRank; } // starts with if (testString.indexOf(stringToRank) === 0) { return rankings.STARTS_WITH + caseRank; } // word starts with if (testString.indexOf(" " + stringToRank) !== -1) { return rankings.WORD_STARTS_WITH + caseRank; } // is a part inside a cased string if (isPartial) { return rankings.STRING_CASE + caseRank; } // is acronym for a cased string if (caseRank > 0 && isCasedAcronym) { return rankings.STRING_CASE_ACRONYM + caseRank; } // contains if (testString.indexOf(stringToRank) !== -1) { return rankings.CONTAINS + caseRank; } else if (stringToRank.length === 1) { // If the only character in the given stringToRank // isn't even contained in the testString, then // it's definitely not a match. return rankings.NO_MATCH; } // acronym if (getAcronym(testString).indexOf(stringToRank) !== -1) { return rankings.ACRONYM + caseRank; } // will return a number between rankings.MATCHES and // rankings.MATCHES + 1 depending on how close of a match it is. return getClosenessRanking(testString, stringToRank); } /** * Generates an acronym for a string. * * @param {String} string the string for which to produce the acronym * @returns {String} the acronym */ function getAcronym(string) { var acronym = ''; var wordsInString = string.split(' '); wordsInString.forEach(function (wordInString) { var splitByHyphenWords = wordInString.split('-'); splitByHyphenWords.forEach(function (splitByHyphenWord) { acronym += splitByHyphenWord.substr(0, 1); }); }); return acronym; } /** * Returns a score base on the case of the testString * @param {String} testString - the string to test against * @returns {Number} the number of the ranking, * based on the case between 0 and 1 for how the testString matches the case */ function getCaseRanking(testString) { var containsUpperCase = testString.toLowerCase() !== testString; var containsDash = testString.indexOf('-') >= 0; var containsUnderscore = testString.indexOf('_') >= 0; if (!containsUpperCase && !containsUnderscore && containsDash) { return caseRankings.KEBAB; } if (!containsUpperCase && containsUnderscore && !containsDash) { return caseRankings.SNAKE; } if (containsUpperCase && !containsDash && !containsUnderscore) { var startsWithUpperCase = testString[0].toUpperCase() === testString[0]; if (startsWithUpperCase) { return caseRankings.PASCAL; } return caseRankings.CAMEL; } return caseRankings.NO_CASE; } /** * Returns whether the stringToRank is one of the case parts in the testString (works with any string case) * @example * // returns true * isPartialOfCase('helloWorld', 'world', caseRankings.CAMEL) * @example * // returns false * isPartialOfCase('helloWorld', 'oworl', caseRankings.CAMEL) * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Number} caseRanking - the ranking score based on case of testString * @returns {Boolean} whether the stringToRank is one of the case parts in the testString */ function isPartialOfCase(testString, stringToRank, caseRanking) { var testIndex = testString.toLowerCase().indexOf(stringToRank.toLowerCase()); switch (caseRanking) { case caseRankings.SNAKE: return testString[testIndex - 1] === '_'; case caseRankings.KEBAB: return testString[testIndex - 1] === '-'; case caseRankings.PASCAL: case caseRankings.CAMEL: return testIndex !== -1 && testString[testIndex] === testString[testIndex].toUpperCase(); default: return false; } } /** * Check if stringToRank is an acronym for a partial case * @example * // returns true * isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE) * @param {String} testString - the string to test against * @param {String} stringToRank - the acronym to test * @param {Number} caseRank - the ranking of the case * @returns {Boolean} whether the stringToRank is an acronym for the testString */ function isCaseAcronym(testString, stringToRank, caseRank) { var splitValue = null; switch (caseRank) { case caseRankings.SNAKE: splitValue = '_'; break; case caseRankings.KEBAB: splitValue = '-'; break; case caseRankings.PASCAL: case caseRankings.CAMEL: splitValue = /(?=[A-Z])/; break; default: splitValue = null; } var splitTestString = testString.split(splitValue); return stringToRank.toLowerCase().split('').reduce(function (correct, char, charIndex) { var splitItem = splitTestString[charIndex]; return correct && splitItem && splitItem[0].toLowerCase() === char; }, true); } /** * Returns a score based on how spread apart the * characters from the stringToRank are within the testString. * A number close to rankings.MATCHES represents a loose match. A number close * to rankings.MATCHES + 1 represents a tighter match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @returns {Number} the number between rankings.MATCHES and * rankings.MATCHES + 1 for how well stringToRank matches testString */ function getClosenessRanking(testString, stringToRank) { var matchingInOrderCharCount = 0; var charNumber = 0; function findMatchingCharacter(matchChar, string, index) { for (var j = index; j < string.length; j++) { var stringChar = string[j]; if (stringChar === matchChar) { matchingInOrderCharCount += 1; return j + 1; } } return -1; } function getRanking(spread) { var inOrderPercentage = matchingInOrderCharCount / stringToRank.length; var ranking = rankings.MATCHES + inOrderPercentage * (1 / spread); return ranking; } var firstIndex = findMatchingCharacter(stringToRank[0], testString, 0); if (firstIndex < 0) { return rankings.NO_MATCH; } charNumber = firstIndex; for (var i = 1; i < stringToRank.length; i++) { var matchChar = stringToRank[i]; charNumber = findMatchingCharacter(matchChar, testString, charNumber); var found = charNumber > -1; if (!found) { return rankings.NO_MATCH; } } var spread = charNumber - firstIndex; return getRanking(spread); } /** * Sorts items that have a rank, index, and keyIndex * @param {Object} a - the first item to sort * @param {Object} b - the second item to sort * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal */ function sortRankedItems(a, b, baseSort) { var aFirst = -1; var bFirst = 1; var aRank = a.rank, aKeyIndex = a.keyIndex; var bRank = b.rank, bKeyIndex = b.keyIndex; if (aRank === bRank) { if (aKeyIndex === bKeyIndex) { // use the base sort function as a tie-breaker return baseSort(a, b); } else { return aKeyIndex < bKeyIndex ? aFirst : bFirst; } } else { return aRank > bRank ? aFirst : bFirst; } } /** * Prepares value for comparison by stringifying it, removing diacritics (if specified) * @param {String} value - the value to clean * @param {Object} options - {keepDiacritics: whether to remove diacritics} * @return {String} the prepared value */ function prepareValueForComparison(value, _ref4) { var keepDiacritics = _ref4.keepDiacritics; value = "" + value; // toString if (!keepDiacritics) { value = removeAccents__default['default'](value); } return value; } /** * Gets value for key in item at arbitrarily nested keypath * @param {Object} item - the item * @param {Object|Function} key - the potentially nested keypath or property callback * @return {Array} - an array containing the value(s) at the nested keypath */ function getItemValues(item, key) { if (typeof key === 'object') { key = key.key; } var value; if (typeof key === 'function') { value = key(item); // eslint-disable-next-line no-negated-condition } else if (key.indexOf('.') !== -1) { // handle nested keys value = key.split('.').reduce(function (itemObj, nestedKey) { return itemObj ? itemObj[nestedKey] : null; }, item); } else { value = item[key]; } // concat because `value` can be a string or an array // eslint-disable-next-line return value != null ? [].concat(value) : null; } /** * Gets all the values for the given keys in the given item and returns an array of those values * @param {Object} item - the item from which the values will be retrieved * @param {Array} keys - the keys to use to retrieve the values * @return {Array} objects with {itemValue, attributes} */ function getAllValuesToRank(item, keys) { return keys.reduce(function (allVals, 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__default['default']({ maxRanking: Infinity, minRanking: -Infinity }, key); } exports.default = matchSorter; exports.rankings = rankings; PK k�}[ʤ1�R9 R9 dist/match-sorter.esm.jsnu �Iw�� import _extends from '@babel/runtime/helpers/esm/extends'; import removeAccents from 'remove-accents'; var rankings = { 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 }; var caseRankings = { CAMEL: 0.8, PASCAL: 0.6, KEBAB: 0.4, SNAKE: 0.2, NO_CASE: 0 }; matchSorter.rankings = rankings; matchSorter.caseRankings = caseRankings; var defaultBaseSortFn = function (a, b) { return String(a.rankedItem).localeCompare(b.rankedItem); }; /** * Takes an array of items and a value and returns a new array with the items that match the given value * @param {Array} items - the items to sort * @param {String} value - the value to use for ranking * @param {Object} options - Some options to configure the sorter * @return {Array} - the new sorted array */ function matchSorter(items, value, options) { if (options === void 0) { options = {}; } var _options = options, keys = _options.keys, _options$threshold = _options.threshold, threshold = _options$threshold === void 0 ? rankings.MATCHES : _options$threshold, _options$baseSort = _options.baseSort, baseSort = _options$baseSort === void 0 ? defaultBaseSortFn : _options$baseSort; var matchedItems = items.reduce(reduceItemsToRanked, []); return matchedItems.sort(function (a, b) { return sortRankedItems(a, b, baseSort); }).map(function (_ref) { var item = _ref.item; return item; }); function reduceItemsToRanked(matches, item, index) { var _getHighestRanking = getHighestRanking(item, keys, value, options), rankedItem = _getHighestRanking.rankedItem, rank = _getHighestRanking.rank, keyIndex = _getHighestRanking.keyIndex, _getHighestRanking$ke = _getHighestRanking.keyThreshold, keyThreshold = _getHighestRanking$ke === void 0 ? threshold : _getHighestRanking$ke; if (rank >= keyThreshold) { matches.push({ rankedItem: rankedItem, item: item, rank: rank, index: index, keyIndex: keyIndex }); } return matches; } } /** * Gets the highest ranking for value for the given item based on its values for the given keys * @param {*} item - the item to rank * @param {Array} keys - the keys to get values from the item for the ranking * @param {String} value - the value to rank against * @param {Object} options - options to control the ranking * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking */ function getHighestRanking(item, keys, value, options) { if (!keys) { return { // ends up being duplicate of 'item' in matches but consistent rankedItem: item, rank: getMatchRanking(item, value, options), keyIndex: -1, keyThreshold: options.threshold }; } var valuesToRank = getAllValuesToRank(item, keys); return valuesToRank.reduce(function (_ref2, _ref3, i) { var rank = _ref2.rank, rankedItem = _ref2.rankedItem, keyIndex = _ref2.keyIndex, keyThreshold = _ref2.keyThreshold; var itemValue = _ref3.itemValue, attributes = _ref3.attributes; var newRank = getMatchRanking(itemValue, value, options); var newRankedItem = rankedItem; var minRanking = attributes.minRanking, maxRanking = attributes.maxRanking, threshold = attributes.threshold; if (newRank < minRanking && newRank >= rankings.MATCHES) { newRank = minRanking; } else if (newRank > maxRanking) { newRank = maxRanking; } if (newRank > rank) { rank = newRank; keyIndex = i; keyThreshold = threshold; newRankedItem = itemValue; } return { rankedItem: newRankedItem, rank: rank, keyIndex: keyIndex, keyThreshold: keyThreshold }; }, { rank: rankings.NO_MATCH, keyIndex: -1, keyThreshold: options.threshold }); } /** * Gives a rankings score based on how well the two strings match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Object} options - options for the match (like keepDiacritics for comparison) * @returns {Number} the ranking for how well stringToRank matches testString */ function getMatchRanking(testString, stringToRank, options) { /* eslint complexity:[2, 12] */ testString = prepareValueForComparison(testString, options); stringToRank = prepareValueForComparison(stringToRank, options); // too long if (stringToRank.length > testString.length) { return rankings.NO_MATCH; } // case sensitive equals if (testString === stringToRank) { return rankings.CASE_SENSITIVE_EQUAL; } var caseRank = getCaseRanking(testString); var isPartial = isPartialOfCase(testString, stringToRank, caseRank); var isCasedAcronym = isCaseAcronym(testString, stringToRank, caseRank); // Lower casing before further comparison testString = testString.toLowerCase(); stringToRank = stringToRank.toLowerCase(); // case insensitive equals if (testString === stringToRank) { return rankings.EQUAL + caseRank; } // starts with if (testString.indexOf(stringToRank) === 0) { return rankings.STARTS_WITH + caseRank; } // word starts with if (testString.indexOf(" " + stringToRank) !== -1) { return rankings.WORD_STARTS_WITH + caseRank; } // is a part inside a cased string if (isPartial) { return rankings.STRING_CASE + caseRank; } // is acronym for a cased string if (caseRank > 0 && isCasedAcronym) { return rankings.STRING_CASE_ACRONYM + caseRank; } // contains if (testString.indexOf(stringToRank) !== -1) { return rankings.CONTAINS + caseRank; } else if (stringToRank.length === 1) { // If the only character in the given stringToRank // isn't even contained in the testString, then // it's definitely not a match. return rankings.NO_MATCH; } // acronym if (getAcronym(testString).indexOf(stringToRank) !== -1) { return rankings.ACRONYM + caseRank; } // will return a number between rankings.MATCHES and // rankings.MATCHES + 1 depending on how close of a match it is. return getClosenessRanking(testString, stringToRank); } /** * Generates an acronym for a string. * * @param {String} string the string for which to produce the acronym * @returns {String} the acronym */ function getAcronym(string) { var acronym = ''; var wordsInString = string.split(' '); wordsInString.forEach(function (wordInString) { var splitByHyphenWords = wordInString.split('-'); splitByHyphenWords.forEach(function (splitByHyphenWord) { acronym += splitByHyphenWord.substr(0, 1); }); }); return acronym; } /** * Returns a score base on the case of the testString * @param {String} testString - the string to test against * @returns {Number} the number of the ranking, * based on the case between 0 and 1 for how the testString matches the case */ function getCaseRanking(testString) { var containsUpperCase = testString.toLowerCase() !== testString; var containsDash = testString.indexOf('-') >= 0; var containsUnderscore = testString.indexOf('_') >= 0; if (!containsUpperCase && !containsUnderscore && containsDash) { return caseRankings.KEBAB; } if (!containsUpperCase && containsUnderscore && !containsDash) { return caseRankings.SNAKE; } if (containsUpperCase && !containsDash && !containsUnderscore) { var startsWithUpperCase = testString[0].toUpperCase() === testString[0]; if (startsWithUpperCase) { return caseRankings.PASCAL; } return caseRankings.CAMEL; } return caseRankings.NO_CASE; } /** * Returns whether the stringToRank is one of the case parts in the testString (works with any string case) * @example * // returns true * isPartialOfCase('helloWorld', 'world', caseRankings.CAMEL) * @example * // returns false * isPartialOfCase('helloWorld', 'oworl', caseRankings.CAMEL) * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Number} caseRanking - the ranking score based on case of testString * @returns {Boolean} whether the stringToRank is one of the case parts in the testString */ function isPartialOfCase(testString, stringToRank, caseRanking) { var testIndex = testString.toLowerCase().indexOf(stringToRank.toLowerCase()); switch (caseRanking) { case caseRankings.SNAKE: return testString[testIndex - 1] === '_'; case caseRankings.KEBAB: return testString[testIndex - 1] === '-'; case caseRankings.PASCAL: case caseRankings.CAMEL: return testIndex !== -1 && testString[testIndex] === testString[testIndex].toUpperCase(); default: return false; } } /** * Check if stringToRank is an acronym for a partial case * @example * // returns true * isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE) * @param {String} testString - the string to test against * @param {String} stringToRank - the acronym to test * @param {Number} caseRank - the ranking of the case * @returns {Boolean} whether the stringToRank is an acronym for the testString */ function isCaseAcronym(testString, stringToRank, caseRank) { var splitValue = null; switch (caseRank) { case caseRankings.SNAKE: splitValue = '_'; break; case caseRankings.KEBAB: splitValue = '-'; break; case caseRankings.PASCAL: case caseRankings.CAMEL: splitValue = /(?=[A-Z])/; break; default: splitValue = null; } var splitTestString = testString.split(splitValue); return stringToRank.toLowerCase().split('').reduce(function (correct, char, charIndex) { var splitItem = splitTestString[charIndex]; return correct && splitItem && splitItem[0].toLowerCase() === char; }, true); } /** * Returns a score based on how spread apart the * characters from the stringToRank are within the testString. * A number close to rankings.MATCHES represents a loose match. A number close * to rankings.MATCHES + 1 represents a tighter match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @returns {Number} the number between rankings.MATCHES and * rankings.MATCHES + 1 for how well stringToRank matches testString */ function getClosenessRanking(testString, stringToRank) { var matchingInOrderCharCount = 0; var charNumber = 0; function findMatchingCharacter(matchChar, string, index) { for (var j = index; j < string.length; j++) { var stringChar = string[j]; if (stringChar === matchChar) { matchingInOrderCharCount += 1; return j + 1; } } return -1; } function getRanking(spread) { var inOrderPercentage = matchingInOrderCharCount / stringToRank.length; var ranking = rankings.MATCHES + inOrderPercentage * (1 / spread); return ranking; } var firstIndex = findMatchingCharacter(stringToRank[0], testString, 0); if (firstIndex < 0) { return rankings.NO_MATCH; } charNumber = firstIndex; for (var i = 1; i < stringToRank.length; i++) { var matchChar = stringToRank[i]; charNumber = findMatchingCharacter(matchChar, testString, charNumber); var found = charNumber > -1; if (!found) { return rankings.NO_MATCH; } } var spread = charNumber - firstIndex; return getRanking(spread); } /** * Sorts items that have a rank, index, and keyIndex * @param {Object} a - the first item to sort * @param {Object} b - the second item to sort * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal */ function sortRankedItems(a, b, baseSort) { var aFirst = -1; var bFirst = 1; var aRank = a.rank, aKeyIndex = a.keyIndex; var bRank = b.rank, bKeyIndex = b.keyIndex; if (aRank === bRank) { if (aKeyIndex === bKeyIndex) { // use the base sort function as a tie-breaker return baseSort(a, b); } else { return aKeyIndex < bKeyIndex ? aFirst : bFirst; } } else { return aRank > bRank ? aFirst : bFirst; } } /** * Prepares value for comparison by stringifying it, removing diacritics (if specified) * @param {String} value - the value to clean * @param {Object} options - {keepDiacritics: whether to remove diacritics} * @return {String} the prepared value */ function prepareValueForComparison(value, _ref4) { var keepDiacritics = _ref4.keepDiacritics; value = "" + value; // toString if (!keepDiacritics) { value = removeAccents(value); } return value; } /** * Gets value for key in item at arbitrarily nested keypath * @param {Object} item - the item * @param {Object|Function} key - the potentially nested keypath or property callback * @return {Array} - an array containing the value(s) at the nested keypath */ function getItemValues(item, key) { if (typeof key === 'object') { key = key.key; } var value; if (typeof key === 'function') { value = key(item); // eslint-disable-next-line no-negated-condition } else if (key.indexOf('.') !== -1) { // handle nested keys value = key.split('.').reduce(function (itemObj, nestedKey) { return itemObj ? itemObj[nestedKey] : null; }, item); } else { value = item[key]; } // concat because `value` can be a string or an array // eslint-disable-next-line return value != null ? [].concat(value) : null; } /** * Gets all the values for the given keys in the given item and returns an array of those values * @param {Object} item - the item from which the values will be retrieved * @param {Array} keys - the keys to use to retrieve the values * @return {Array} objects with {itemValue, attributes} */ function getAllValuesToRank(item, keys) { return keys.reduce(function (allVals, 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); } export default matchSorter; export { rankings }; PK k�}[ϵgQ�Y �Y dist/match-sorter.umd.jsnu �Iw�� (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.matchSorter = {})); }(this, (function (exports) { 'use strict'; function _extends() { _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; }; return _extends.apply(this, arguments); } var characterMap = { "À": "A", "Á": "A", "Â": "A", "Ã": "A", "Ä": "A", "Å": "A", "Ấ": "A", "Ắ": "A", "Ẳ": "A", "Ẵ": "A", "Ặ": "A", "Æ": "AE", "Ầ": "A", "Ằ": "A", "Ȃ": "A", "Ç": "C", "Ḉ": "C", "È": "E", "É": "E", "Ê": "E", "Ë": "E", "Ế": "E", "Ḗ": "E", "Ề": "E", "Ḕ": "E", "Ḝ": "E", "Ȇ": "E", "Ì": "I", "Í": "I", "Î": "I", "Ï": "I", "Ḯ": "I", "Ȋ": "I", "Ð": "D", "Ñ": "N", "Ò": "O", "Ó": "O", "Ô": "O", "Õ": "O", "Ö": "O", "Ø": "O", "Ố": "O", "Ṍ": "O", "Ṓ": "O", "Ȏ": "O", "Ù": "U", "Ú": "U", "Û": "U", "Ü": "U", "Ý": "Y", "à": "a", "á": "a", "â": "a", "ã": "a", "ä": "a", "å": "a", "ấ": "a", "ắ": "a", "ẳ": "a", "ẵ": "a", "ặ": "a", "æ": "ae", "ầ": "a", "ằ": "a", "ȃ": "a", "ç": "c", "ḉ": "c", "è": "e", "é": "e", "ê": "e", "ë": "e", "ế": "e", "ḗ": "e", "ề": "e", "ḕ": "e", "ḝ": "e", "ȇ": "e", "ì": "i", "í": "i", "î": "i", "ï": "i", "ḯ": "i", "ȋ": "i", "ð": "d", "ñ": "n", "ò": "o", "ó": "o", "ô": "o", "õ": "o", "ö": "o", "ø": "o", "ố": "o", "ṍ": "o", "ṓ": "o", "ȏ": "o", "ù": "u", "ú": "u", "û": "u", "ü": "u", "ý": "y", "ÿ": "y", "Ā": "A", "ā": "a", "Ă": "A", "ă": "a", "Ą": "A", "ą": "a", "Ć": "C", "ć": "c", "Ĉ": "C", "ĉ": "c", "Ċ": "C", "ċ": "c", "Č": "C", "č": "c", "C̆": "C", "c̆": "c", "Ď": "D", "ď": "d", "Đ": "D", "đ": "d", "Ē": "E", "ē": "e", "Ĕ": "E", "ĕ": "e", "Ė": "E", "ė": "e", "Ę": "E", "ę": "e", "Ě": "E", "ě": "e", "Ĝ": "G", "Ǵ": "G", "ĝ": "g", "ǵ": "g", "Ğ": "G", "ğ": "g", "Ġ": "G", "ġ": "g", "Ģ": "G", "ģ": "g", "Ĥ": "H", "ĥ": "h", "Ħ": "H", "ħ": "h", "Ḫ": "H", "ḫ": "h", "Ĩ": "I", "ĩ": "i", "Ī": "I", "ī": "i", "Ĭ": "I", "ĭ": "i", "Į": "I", "į": "i", "İ": "I", "ı": "i", "IJ": "IJ", "ij": "ij", "Ĵ": "J", "ĵ": "j", "Ķ": "K", "ķ": "k", "Ḱ": "K", "ḱ": "k", "K̆": "K", "k̆": "k", "Ĺ": "L", "ĺ": "l", "Ļ": "L", "ļ": "l", "Ľ": "L", "ľ": "l", "Ŀ": "L", "ŀ": "l", "Ł": "l", "ł": "l", "Ḿ": "M", "ḿ": "m", "M̆": "M", "m̆": "m", "Ń": "N", "ń": "n", "Ņ": "N", "ņ": "n", "Ň": "N", "ň": "n", "ʼn": "n", "N̆": "N", "n̆": "n", "Ō": "O", "ō": "o", "Ŏ": "O", "ŏ": "o", "Ő": "O", "ő": "o", "Œ": "OE", "œ": "oe", "P̆": "P", "p̆": "p", "Ŕ": "R", "ŕ": "r", "Ŗ": "R", "ŗ": "r", "Ř": "R", "ř": "r", "R̆": "R", "r̆": "r", "Ȓ": "R", "ȓ": "r", "Ś": "S", "ś": "s", "Ŝ": "S", "ŝ": "s", "Ş": "S", "Ș": "S", "ș": "s", "ş": "s", "Š": "S", "š": "s", "Ţ": "T", "ţ": "t", "ț": "t", "Ț": "T", "Ť": "T", "ť": "t", "Ŧ": "T", "ŧ": "t", "T̆": "T", "t̆": "t", "Ũ": "U", "ũ": "u", "Ū": "U", "ū": "u", "Ŭ": "U", "ŭ": "u", "Ů": "U", "ů": "u", "Ű": "U", "ű": "u", "Ų": "U", "ų": "u", "Ȗ": "U", "ȗ": "u", "V̆": "V", "v̆": "v", "Ŵ": "W", "ŵ": "w", "Ẃ": "W", "ẃ": "w", "X̆": "X", "x̆": "x", "Ŷ": "Y", "ŷ": "y", "Ÿ": "Y", "Y̆": "Y", "y̆": "y", "Ź": "Z", "ź": "z", "Ż": "Z", "ż": "z", "Ž": "Z", "ž": "z", "ſ": "s", "ƒ": "f", "Ơ": "O", "ơ": "o", "Ư": "U", "ư": "u", "Ǎ": "A", "ǎ": "a", "Ǐ": "I", "ǐ": "i", "Ǒ": "O", "ǒ": "o", "Ǔ": "U", "ǔ": "u", "Ǖ": "U", "ǖ": "u", "Ǘ": "U", "ǘ": "u", "Ǚ": "U", "ǚ": "u", "Ǜ": "U", "ǜ": "u", "Ứ": "U", "ứ": "u", "Ṹ": "U", "ṹ": "u", "Ǻ": "A", "ǻ": "a", "Ǽ": "AE", "ǽ": "ae", "Ǿ": "O", "ǿ": "o", "Þ": "TH", "þ": "th", "Ṕ": "P", "ṕ": "p", "Ṥ": "S", "ṥ": "s", "X́": "X", "x́": "x", "Ѓ": "Г", "ѓ": "г", "Ќ": "К", "ќ": "к", "A̋": "A", "a̋": "a", "E̋": "E", "e̋": "e", "I̋": "I", "i̋": "i", "Ǹ": "N", "ǹ": "n", "Ồ": "O", "ồ": "o", "Ṑ": "O", "ṑ": "o", "Ừ": "U", "ừ": "u", "Ẁ": "W", "ẁ": "w", "Ỳ": "Y", "ỳ": "y", "Ȁ": "A", "ȁ": "a", "Ȅ": "E", "ȅ": "e", "Ȉ": "I", "ȉ": "i", "Ȍ": "O", "ȍ": "o", "Ȑ": "R", "ȑ": "r", "Ȕ": "U", "ȕ": "u", "B̌": "B", "b̌": "b", "Č̣": "C", "č̣": "c", "Ê̌": "E", "ê̌": "e", "F̌": "F", "f̌": "f", "Ǧ": "G", "ǧ": "g", "Ȟ": "H", "ȟ": "h", "J̌": "J", "ǰ": "j", "Ǩ": "K", "ǩ": "k", "M̌": "M", "m̌": "m", "P̌": "P", "p̌": "p", "Q̌": "Q", "q̌": "q", "Ř̩": "R", "ř̩": "r", "Ṧ": "S", "ṧ": "s", "V̌": "V", "v̌": "v", "W̌": "W", "w̌": "w", "X̌": "X", "x̌": "x", "Y̌": "Y", "y̌": "y", "A̧": "A", "a̧": "a", "B̧": "B", "b̧": "b", "Ḑ": "D", "ḑ": "d", "Ȩ": "E", "ȩ": "e", "Ɛ̧": "E", "ɛ̧": "e", "Ḩ": "H", "ḩ": "h", "I̧": "I", "i̧": "i", "Ɨ̧": "I", "ɨ̧": "i", "M̧": "M", "m̧": "m", "O̧": "O", "o̧": "o", "Q̧": "Q", "q̧": "q", "U̧": "U", "u̧": "u", "X̧": "X", "x̧": "x", "Z̧": "Z", "z̧": "z" }; var chars = Object.keys(characterMap).join('|'); var allAccents = new RegExp(chars, 'g'); var firstAccent = new RegExp(chars, ''); var removeAccents = function (string) { return string.replace(allAccents, function (match) { return characterMap[match]; }); }; var hasAccents = function (string) { return !!string.match(firstAccent); }; var removeAccents_1 = removeAccents; var has = hasAccents; var remove = removeAccents; removeAccents_1.has = has; removeAccents_1.remove = remove; var rankings = { 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 }; var caseRankings = { CAMEL: 0.8, PASCAL: 0.6, KEBAB: 0.4, SNAKE: 0.2, NO_CASE: 0 }; matchSorter.rankings = rankings; matchSorter.caseRankings = caseRankings; var defaultBaseSortFn = function (a, b) { return String(a.rankedItem).localeCompare(b.rankedItem); }; /** * Takes an array of items and a value and returns a new array with the items that match the given value * @param {Array} items - the items to sort * @param {String} value - the value to use for ranking * @param {Object} options - Some options to configure the sorter * @return {Array} - the new sorted array */ function matchSorter(items, value, options) { if (options === void 0) { options = {}; } var _options = options, keys = _options.keys, _options$threshold = _options.threshold, threshold = _options$threshold === void 0 ? rankings.MATCHES : _options$threshold, _options$baseSort = _options.baseSort, baseSort = _options$baseSort === void 0 ? defaultBaseSortFn : _options$baseSort; var matchedItems = items.reduce(reduceItemsToRanked, []); return matchedItems.sort(function (a, b) { return sortRankedItems(a, b, baseSort); }).map(function (_ref) { var item = _ref.item; return item; }); function reduceItemsToRanked(matches, item, index) { var _getHighestRanking = getHighestRanking(item, keys, value, options), rankedItem = _getHighestRanking.rankedItem, rank = _getHighestRanking.rank, keyIndex = _getHighestRanking.keyIndex, _getHighestRanking$ke = _getHighestRanking.keyThreshold, keyThreshold = _getHighestRanking$ke === void 0 ? threshold : _getHighestRanking$ke; if (rank >= keyThreshold) { matches.push({ rankedItem: rankedItem, item: item, rank: rank, index: index, keyIndex: keyIndex }); } return matches; } } /** * Gets the highest ranking for value for the given item based on its values for the given keys * @param {*} item - the item to rank * @param {Array} keys - the keys to get values from the item for the ranking * @param {String} value - the value to rank against * @param {Object} options - options to control the ranking * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking */ function getHighestRanking(item, keys, value, options) { if (!keys) { return { // ends up being duplicate of 'item' in matches but consistent rankedItem: item, rank: getMatchRanking(item, value, options), keyIndex: -1, keyThreshold: options.threshold }; } var valuesToRank = getAllValuesToRank(item, keys); return valuesToRank.reduce(function (_ref2, _ref3, i) { var rank = _ref2.rank, rankedItem = _ref2.rankedItem, keyIndex = _ref2.keyIndex, keyThreshold = _ref2.keyThreshold; var itemValue = _ref3.itemValue, attributes = _ref3.attributes; var newRank = getMatchRanking(itemValue, value, options); var newRankedItem = rankedItem; var minRanking = attributes.minRanking, maxRanking = attributes.maxRanking, threshold = attributes.threshold; if (newRank < minRanking && newRank >= rankings.MATCHES) { newRank = minRanking; } else if (newRank > maxRanking) { newRank = maxRanking; } if (newRank > rank) { rank = newRank; keyIndex = i; keyThreshold = threshold; newRankedItem = itemValue; } return { rankedItem: newRankedItem, rank: rank, keyIndex: keyIndex, keyThreshold: keyThreshold }; }, { rank: rankings.NO_MATCH, keyIndex: -1, keyThreshold: options.threshold }); } /** * Gives a rankings score based on how well the two strings match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Object} options - options for the match (like keepDiacritics for comparison) * @returns {Number} the ranking for how well stringToRank matches testString */ function getMatchRanking(testString, stringToRank, options) { /* eslint complexity:[2, 12] */ testString = prepareValueForComparison(testString, options); stringToRank = prepareValueForComparison(stringToRank, options); // too long if (stringToRank.length > testString.length) { return rankings.NO_MATCH; } // case sensitive equals if (testString === stringToRank) { return rankings.CASE_SENSITIVE_EQUAL; } var caseRank = getCaseRanking(testString); var isPartial = isPartialOfCase(testString, stringToRank, caseRank); var isCasedAcronym = isCaseAcronym(testString, stringToRank, caseRank); // Lower casing before further comparison testString = testString.toLowerCase(); stringToRank = stringToRank.toLowerCase(); // case insensitive equals if (testString === stringToRank) { return rankings.EQUAL + caseRank; } // starts with if (testString.indexOf(stringToRank) === 0) { return rankings.STARTS_WITH + caseRank; } // word starts with if (testString.indexOf(" " + stringToRank) !== -1) { return rankings.WORD_STARTS_WITH + caseRank; } // is a part inside a cased string if (isPartial) { return rankings.STRING_CASE + caseRank; } // is acronym for a cased string if (caseRank > 0 && isCasedAcronym) { return rankings.STRING_CASE_ACRONYM + caseRank; } // contains if (testString.indexOf(stringToRank) !== -1) { return rankings.CONTAINS + caseRank; } else if (stringToRank.length === 1) { // If the only character in the given stringToRank // isn't even contained in the testString, then // it's definitely not a match. return rankings.NO_MATCH; } // acronym if (getAcronym(testString).indexOf(stringToRank) !== -1) { return rankings.ACRONYM + caseRank; } // will return a number between rankings.MATCHES and // rankings.MATCHES + 1 depending on how close of a match it is. return getClosenessRanking(testString, stringToRank); } /** * Generates an acronym for a string. * * @param {String} string the string for which to produce the acronym * @returns {String} the acronym */ function getAcronym(string) { var acronym = ''; var wordsInString = string.split(' '); wordsInString.forEach(function (wordInString) { var splitByHyphenWords = wordInString.split('-'); splitByHyphenWords.forEach(function (splitByHyphenWord) { acronym += splitByHyphenWord.substr(0, 1); }); }); return acronym; } /** * Returns a score base on the case of the testString * @param {String} testString - the string to test against * @returns {Number} the number of the ranking, * based on the case between 0 and 1 for how the testString matches the case */ function getCaseRanking(testString) { var containsUpperCase = testString.toLowerCase() !== testString; var containsDash = testString.indexOf('-') >= 0; var containsUnderscore = testString.indexOf('_') >= 0; if (!containsUpperCase && !containsUnderscore && containsDash) { return caseRankings.KEBAB; } if (!containsUpperCase && containsUnderscore && !containsDash) { return caseRankings.SNAKE; } if (containsUpperCase && !containsDash && !containsUnderscore) { var startsWithUpperCase = testString[0].toUpperCase() === testString[0]; if (startsWithUpperCase) { return caseRankings.PASCAL; } return caseRankings.CAMEL; } return caseRankings.NO_CASE; } /** * Returns whether the stringToRank is one of the case parts in the testString (works with any string case) * @example * // returns true * isPartialOfCase('helloWorld', 'world', caseRankings.CAMEL) * @example * // returns false * isPartialOfCase('helloWorld', 'oworl', caseRankings.CAMEL) * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @param {Number} caseRanking - the ranking score based on case of testString * @returns {Boolean} whether the stringToRank is one of the case parts in the testString */ function isPartialOfCase(testString, stringToRank, caseRanking) { var testIndex = testString.toLowerCase().indexOf(stringToRank.toLowerCase()); switch (caseRanking) { case caseRankings.SNAKE: return testString[testIndex - 1] === '_'; case caseRankings.KEBAB: return testString[testIndex - 1] === '-'; case caseRankings.PASCAL: case caseRankings.CAMEL: return testIndex !== -1 && testString[testIndex] === testString[testIndex].toUpperCase(); default: return false; } } /** * Check if stringToRank is an acronym for a partial case * @example * // returns true * isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE) * @param {String} testString - the string to test against * @param {String} stringToRank - the acronym to test * @param {Number} caseRank - the ranking of the case * @returns {Boolean} whether the stringToRank is an acronym for the testString */ function isCaseAcronym(testString, stringToRank, caseRank) { var splitValue = null; switch (caseRank) { case caseRankings.SNAKE: splitValue = '_'; break; case caseRankings.KEBAB: splitValue = '-'; break; case caseRankings.PASCAL: case caseRankings.CAMEL: splitValue = /(?=[A-Z])/; break; default: splitValue = null; } var splitTestString = testString.split(splitValue); return stringToRank.toLowerCase().split('').reduce(function (correct, char, charIndex) { var splitItem = splitTestString[charIndex]; return correct && splitItem && splitItem[0].toLowerCase() === char; }, true); } /** * Returns a score based on how spread apart the * characters from the stringToRank are within the testString. * A number close to rankings.MATCHES represents a loose match. A number close * to rankings.MATCHES + 1 represents a tighter match. * @param {String} testString - the string to test against * @param {String} stringToRank - the string to rank * @returns {Number} the number between rankings.MATCHES and * rankings.MATCHES + 1 for how well stringToRank matches testString */ function getClosenessRanking(testString, stringToRank) { var matchingInOrderCharCount = 0; var charNumber = 0; function findMatchingCharacter(matchChar, string, index) { for (var j = index; j < string.length; j++) { var stringChar = string[j]; if (stringChar === matchChar) { matchingInOrderCharCount += 1; return j + 1; } } return -1; } function getRanking(spread) { var inOrderPercentage = matchingInOrderCharCount / stringToRank.length; var ranking = rankings.MATCHES + inOrderPercentage * (1 / spread); return ranking; } var firstIndex = findMatchingCharacter(stringToRank[0], testString, 0); if (firstIndex < 0) { return rankings.NO_MATCH; } charNumber = firstIndex; for (var i = 1; i < stringToRank.length; i++) { var matchChar = stringToRank[i]; charNumber = findMatchingCharacter(matchChar, testString, charNumber); var found = charNumber > -1; if (!found) { return rankings.NO_MATCH; } } var spread = charNumber - firstIndex; return getRanking(spread); } /** * Sorts items that have a rank, index, and keyIndex * @param {Object} a - the first item to sort * @param {Object} b - the second item to sort * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal */ function sortRankedItems(a, b, baseSort) { var aFirst = -1; var bFirst = 1; var aRank = a.rank, aKeyIndex = a.keyIndex; var bRank = b.rank, bKeyIndex = b.keyIndex; if (aRank === bRank) { if (aKeyIndex === bKeyIndex) { // use the base sort function as a tie-breaker return baseSort(a, b); } else { return aKeyIndex < bKeyIndex ? aFirst : bFirst; } } else { return aRank > bRank ? aFirst : bFirst; } } /** * Prepares value for comparison by stringifying it, removing diacritics (if specified) * @param {String} value - the value to clean * @param {Object} options - {keepDiacritics: whether to remove diacritics} * @return {String} the prepared value */ function prepareValueForComparison(value, _ref4) { var keepDiacritics = _ref4.keepDiacritics; value = "" + value; // toString if (!keepDiacritics) { value = removeAccents_1(value); } return value; } /** * Gets value for key in item at arbitrarily nested keypath * @param {Object} item - the item * @param {Object|Function} key - the potentially nested keypath or property callback * @return {Array} - an array containing the value(s) at the nested keypath */ function getItemValues(item, key) { if (typeof key === 'object') { key = key.key; } var value; if (typeof key === 'function') { value = key(item); // eslint-disable-next-line no-negated-condition } else if (key.indexOf('.') !== -1) { // handle nested keys value = key.split('.').reduce(function (itemObj, nestedKey) { return itemObj ? itemObj[nestedKey] : null; }, item); } else { value = item[key]; } // concat because `value` can be a string or an array // eslint-disable-next-line return value != null ? [].concat(value) : null; } /** * Gets all the values for the given keys in the given item and returns an array of those values * @param {Object} item - the item from which the values will be retrieved * @param {Array} keys - the keys to use to retrieve the values * @return {Array} objects with {itemValue, attributes} */ function getAllValuesToRank(item, keys) { return keys.reduce(function (allVals, 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); } exports.default = matchSorter; exports.rankings = rankings; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=match-sorter.umd.js.map PK k�}[�2�Ce� e� dist/match-sorter.umd.js.mapnu �Iw�� {"version":3,"file":"match-sorter.umd.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/remove-accents/index.js","../src/index.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","var characterMap = {\r\n\t\"À\": \"A\",\r\n\t\"Á\": \"A\",\r\n\t\"Â\": \"A\",\r\n\t\"Ã\": \"A\",\r\n\t\"Ä\": \"A\",\r\n\t\"Å\": \"A\",\r\n\t\"Ấ\": \"A\",\r\n\t\"Ắ\": \"A\",\r\n\t\"Ẳ\": \"A\",\r\n\t\"Ẵ\": \"A\",\r\n\t\"Ặ\": \"A\",\r\n\t\"Æ\": \"AE\",\r\n\t\"Ầ\": \"A\",\r\n\t\"Ằ\": \"A\",\r\n\t\"Ȃ\": \"A\",\r\n\t\"Ç\": \"C\",\r\n\t\"Ḉ\": \"C\",\r\n\t\"È\": \"E\",\r\n\t\"É\": \"E\",\r\n\t\"Ê\": \"E\",\r\n\t\"Ë\": \"E\",\r\n\t\"Ế\": \"E\",\r\n\t\"Ḗ\": \"E\",\r\n\t\"Ề\": \"E\",\r\n\t\"Ḕ\": \"E\",\r\n\t\"Ḝ\": \"E\",\r\n\t\"Ȇ\": \"E\",\r\n\t\"Ì\": \"I\",\r\n\t\"Í\": \"I\",\r\n\t\"Î\": \"I\",\r\n\t\"Ï\": \"I\",\r\n\t\"Ḯ\": \"I\",\r\n\t\"Ȋ\": \"I\",\r\n\t\"Ð\": \"D\",\r\n\t\"Ñ\": \"N\",\r\n\t\"Ò\": \"O\",\r\n\t\"Ó\": \"O\",\r\n\t\"Ô\": \"O\",\r\n\t\"Õ\": \"O\",\r\n\t\"Ö\": \"O\",\r\n\t\"Ø\": \"O\",\r\n\t\"Ố\": \"O\",\r\n\t\"Ṍ\": \"O\",\r\n\t\"Ṓ\": \"O\",\r\n\t\"Ȏ\": \"O\",\r\n\t\"Ù\": \"U\",\r\n\t\"Ú\": \"U\",\r\n\t\"Û\": \"U\",\r\n\t\"Ü\": \"U\",\r\n\t\"Ý\": \"Y\",\r\n\t\"à\": \"a\",\r\n\t\"á\": \"a\",\r\n\t\"â\": \"a\",\r\n\t\"ã\": \"a\",\r\n\t\"ä\": \"a\",\r\n\t\"å\": \"a\",\r\n\t\"ấ\": \"a\",\r\n\t\"ắ\": \"a\",\r\n\t\"ẳ\": \"a\",\r\n\t\"ẵ\": \"a\",\r\n\t\"ặ\": \"a\",\r\n\t\"æ\": \"ae\",\r\n\t\"ầ\": \"a\",\r\n\t\"ằ\": \"a\",\r\n\t\"ȃ\": \"a\",\r\n\t\"ç\": \"c\",\r\n\t\"ḉ\": \"c\",\r\n\t\"è\": \"e\",\r\n\t\"é\": \"e\",\r\n\t\"ê\": \"e\",\r\n\t\"ë\": \"e\",\r\n\t\"ế\": \"e\",\r\n\t\"ḗ\": \"e\",\r\n\t\"ề\": \"e\",\r\n\t\"ḕ\": \"e\",\r\n\t\"ḝ\": \"e\",\r\n\t\"ȇ\": \"e\",\r\n\t\"ì\": \"i\",\r\n\t\"í\": \"i\",\r\n\t\"î\": \"i\",\r\n\t\"ï\": \"i\",\r\n\t\"ḯ\": \"i\",\r\n\t\"ȋ\": \"i\",\r\n\t\"ð\": \"d\",\r\n\t\"ñ\": \"n\",\r\n\t\"ò\": \"o\",\r\n\t\"ó\": \"o\",\r\n\t\"ô\": \"o\",\r\n\t\"õ\": \"o\",\r\n\t\"ö\": \"o\",\r\n\t\"ø\": \"o\",\r\n\t\"ố\": \"o\",\r\n\t\"ṍ\": \"o\",\r\n\t\"ṓ\": \"o\",\r\n\t\"ȏ\": \"o\",\r\n\t\"ù\": \"u\",\r\n\t\"ú\": \"u\",\r\n\t\"û\": \"u\",\r\n\t\"ü\": \"u\",\r\n\t\"ý\": \"y\",\r\n\t\"ÿ\": \"y\",\r\n\t\"Ā\": \"A\",\r\n\t\"ā\": \"a\",\r\n\t\"Ă\": \"A\",\r\n\t\"ă\": \"a\",\r\n\t\"Ą\": \"A\",\r\n\t\"ą\": \"a\",\r\n\t\"Ć\": \"C\",\r\n\t\"ć\": \"c\",\r\n\t\"Ĉ\": \"C\",\r\n\t\"ĉ\": \"c\",\r\n\t\"Ċ\": \"C\",\r\n\t\"ċ\": \"c\",\r\n\t\"Č\": \"C\",\r\n\t\"č\": \"c\",\r\n\t\"C̆\": \"C\",\r\n\t\"c̆\": \"c\",\r\n\t\"Ď\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r\n\t\"Ŀ\": \"L\",\r\n\t\"ŀ\": \"l\",\r\n\t\"Ł\": \"l\",\r\n\t\"ł\": \"l\",\r\n\t\"Ḿ\": \"M\",\r\n\t\"ḿ\": \"m\",\r\n\t\"M̆\": \"M\",\r\n\t\"m̆\": \"m\",\r\n\t\"Ń\": \"N\",\r\n\t\"ń\": \"n\",\r\n\t\"Ņ\": \"N\",\r\n\t\"ņ\": \"n\",\r\n\t\"Ň\": \"N\",\r\n\t\"ň\": \"n\",\r\n\t\"ʼn\": \"n\",\r\n\t\"N̆\": \"N\",\r\n\t\"n̆\": \"n\",\r\n\t\"Ō\": \"O\",\r\n\t\"ō\": \"o\",\r\n\t\"Ŏ\": \"O\",\r\n\t\"ŏ\": \"o\",\r\n\t\"Ő\": \"O\",\r\n\t\"ő\": \"o\",\r\n\t\"Œ\": \"OE\",\r\n\t\"œ\": \"oe\",\r\n\t\"P̆\": \"P\",\r\n\t\"p̆\": \"p\",\r\n\t\"Ŕ\": \"R\",\r\n\t\"ŕ\": \"r\",\r\n\t\"Ŗ\": \"R\",\r\n\t\"ŗ\": \"r\",\r\n\t\"Ř\": \"R\",\r\n\t\"ř\": \"r\",\r\n\t\"R̆\": \"R\",\r\n\t\"r̆\": \"r\",\r\n\t\"Ȓ\": \"R\",\r\n\t\"ȓ\": \"r\",\r\n\t\"Ś\": \"S\",\r\n\t\"ś\": \"s\",\r\n\t\"Ŝ\": \"S\",\r\n\t\"ŝ\": \"s\",\r\n\t\"Ş\": \"S\",\r\n\t\"Ș\": \"S\",\r\n\t\"ș\": \"s\",\r\n\t\"ş\": \"s\",\r\n\t\"Š\": \"S\",\r\n\t\"š\": \"s\",\r\n\t\"Ţ\": \"T\",\r\n\t\"ţ\": \"t\",\r\n\t\"ț\": \"t\",\r\n\t\"Ț\": \"T\",\r\n\t\"Ť\": \"T\",\r\n\t\"ť\": \"t\",\r\n\t\"Ŧ\": \"T\",\r\n\t\"ŧ\": \"t\",\r\n\t\"T̆\": \"T\",\r\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"B̌\": \"B\",\r\n\t\"b̌\": \"b\",\r\n\t\"Č̣\": \"C\",\r\n\t\"č̣\": \"c\",\r\n\t\"Ê̌\": \"E\",\r\n\t\"ê̌\": \"e\",\r\n\t\"F̌\": \"F\",\r\n\t\"f̌\": \"f\",\r\n\t\"Ǧ\": \"G\",\r\n\t\"ǧ\": \"g\",\r\n\t\"Ȟ\": \"H\",\r\n\t\"ȟ\": \"h\",\r\n\t\"J̌\": \"J\",\r\n\t\"ǰ\": \"j\",\r\n\t\"Ǩ\": \"K\",\r\n\t\"ǩ\": \"k\",\r\n\t\"M̌\": \"M\",\r\n\t\"m̌\": \"m\",\r\n\t\"P̌\": \"P\",\r\n\t\"p̌\": \"p\",\r\n\t\"Q̌\": \"Q\",\r\n\t\"q̌\": \"q\",\r\n\t\"Ř̩\": \"R\",\r\n\t\"ř̩\": \"r\",\r\n\t\"Ṧ\": \"S\",\r\n\t\"ṧ\": \"s\",\r\n\t\"V̌\": \"V\",\r\n\t\"v̌\": \"v\",\r\n\t\"W̌\": \"W\",\r\n\t\"w̌\": \"w\",\r\n\t\"X̌\": \"X\",\r\n\t\"x̌\": \"x\",\r\n\t\"Y̌\": \"Y\",\r\n\t\"y̌\": \"y\",\r\n\t\"A̧\": \"A\",\r\n\t\"a̧\": \"a\",\r\n\t\"B̧\": \"B\",\r\n\t\"b̧\": \"b\",\r\n\t\"Ḑ\": \"D\",\r\n\t\"ḑ\": \"d\",\r\n\t\"Ȩ\": \"E\",\r\n\t\"ȩ\": \"e\",\r\n\t\"Ɛ̧\": \"E\",\r\n\t\"ɛ̧\": \"e\",\r\n\t\"Ḩ\": \"H\",\r\n\t\"ḩ\": \"h\",\r\n\t\"I̧\": \"I\",\r\n\t\"i̧\": \"i\",\r\n\t\"Ɨ̧\": \"I\",\r\n\t\"ɨ̧\": \"i\",\r\n\t\"M̧\": \"M\",\r\n\t\"m̧\": \"m\",\r\n\t\"O̧\": \"O\",\r\n\t\"o̧\": \"o\",\r\n\t\"Q̧\": \"Q\",\r\n\t\"q̧\": \"q\",\r\n\t\"U̧\": \"U\",\r\n\t\"u̧\": \"u\",\r\n\t\"X̧\": \"X\",\r\n\t\"x̧\": \"x\",\r\n\t\"Z̧\": \"Z\",\r\n\t\"z̧\": \"z\",\r\n};\r\n\r\nvar chars = Object.keys(characterMap).join('|');\r\nvar allAccents = new RegExp(chars, 'g');\r\nvar firstAccent = new RegExp(chars, '');\r\n\r\nvar removeAccents = function(string) {\t\r\n\treturn string.replace(allAccents, function(match) {\r\n\t\treturn characterMap[match];\r\n\t});\r\n};\r\n\r\nvar hasAccents = function(string) {\r\n\treturn !!string.match(firstAccent);\r\n};\r\n\r\nmodule.exports = removeAccents;\r\nmodule.exports.has = hasAccents;\r\nmodule.exports.remove = removeAccents;\r\n","/**\n * @name match-sorter\n * @license MIT license.\n * @copyright (c) 2019 Kent C. Dodds\n * @author Kent C. Dodds <kent@doddsfamily.us>\n */\nimport removeAccents from 'remove-accents'\n\nconst rankings = {\n CASE_SENSITIVE_EQUAL: 9,\n EQUAL: 8,\n STARTS_WITH: 7,\n WORD_STARTS_WITH: 6,\n STRING_CASE: 5,\n STRING_CASE_ACRONYM: 4,\n CONTAINS: 3,\n ACRONYM: 2,\n MATCHES: 1,\n NO_MATCH: 0,\n}\n\nconst caseRankings = {\n CAMEL: 0.8,\n PASCAL: 0.6,\n KEBAB: 0.4,\n SNAKE: 0.2,\n NO_CASE: 0,\n}\n\nmatchSorter.rankings = rankings\nmatchSorter.caseRankings = caseRankings\n\nconst defaultBaseSortFn = (a, b) =>\n String(a.rankedItem).localeCompare(b.rankedItem)\n\n/**\n * Takes an array of items and a value and returns a new array with the items that match the given value\n * @param {Array} items - the items to sort\n * @param {String} value - the value to use for ranking\n * @param {Object} options - Some options to configure the sorter\n * @return {Array} - the new sorted array\n */\nfunction matchSorter(items, value, options = {}) {\n const {\n keys,\n threshold = rankings.MATCHES,\n baseSort = defaultBaseSortFn,\n } = options\n const matchedItems = items.reduce(reduceItemsToRanked, [])\n return matchedItems\n .sort((a, b) => sortRankedItems(a, b, baseSort))\n .map(({item}) => item)\n\n function reduceItemsToRanked(matches, item, index) {\n const {\n rankedItem,\n rank,\n keyIndex,\n keyThreshold = threshold,\n } = getHighestRanking(item, keys, value, options)\n if (rank >= keyThreshold) {\n matches.push({rankedItem, item, rank, index, keyIndex})\n }\n return matches\n }\n}\n\n/**\n * Gets the highest ranking for value for the given item based on its values for the given keys\n * @param {*} item - the item to rank\n * @param {Array} keys - the keys to get values from the item for the ranking\n * @param {String} value - the value to rank against\n * @param {Object} options - options to control the ranking\n * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking\n */\nfunction getHighestRanking(item, keys, value, options) {\n if (!keys) {\n return {\n // ends up being duplicate of 'item' in matches but consistent\n rankedItem: item,\n rank: getMatchRanking(item, value, options),\n keyIndex: -1,\n keyThreshold: options.threshold,\n }\n }\n const valuesToRank = getAllValuesToRank(item, keys)\n return valuesToRank.reduce(\n (\n {rank, rankedItem, keyIndex, keyThreshold},\n {itemValue, attributes},\n i,\n ) => {\n let newRank = getMatchRanking(itemValue, value, options)\n let newRankedItem = rankedItem\n const {minRanking, maxRanking, threshold} = attributes\n if (newRank < minRanking && newRank >= rankings.MATCHES) {\n newRank = minRanking\n } else if (newRank > maxRanking) {\n newRank = maxRanking\n }\n if (newRank > rank) {\n rank = newRank\n keyIndex = i\n keyThreshold = threshold\n newRankedItem = itemValue\n }\n return {rankedItem: newRankedItem, rank, keyIndex, keyThreshold}\n },\n {rank: rankings.NO_MATCH, keyIndex: -1, keyThreshold: options.threshold},\n )\n}\n\n/**\n * Gives a rankings score based on how well the two strings match.\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @param {Object} options - options for the match (like keepDiacritics for comparison)\n * @returns {Number} the ranking for how well stringToRank matches testString\n */\nfunction getMatchRanking(testString, stringToRank, options) {\n /* eslint complexity:[2, 12] */\n testString = prepareValueForComparison(testString, options)\n stringToRank = prepareValueForComparison(stringToRank, options)\n\n // too long\n if (stringToRank.length > testString.length) {\n return rankings.NO_MATCH\n }\n\n // case sensitive equals\n if (testString === stringToRank) {\n return rankings.CASE_SENSITIVE_EQUAL\n }\n\n const caseRank = getCaseRanking(testString)\n const isPartial = isPartialOfCase(testString, stringToRank, caseRank)\n const isCasedAcronym = isCaseAcronym(testString, stringToRank, caseRank)\n\n // Lower casing before further comparison\n testString = testString.toLowerCase()\n stringToRank = stringToRank.toLowerCase()\n\n // case insensitive equals\n if (testString === stringToRank) {\n return rankings.EQUAL + caseRank\n }\n\n // starts with\n if (testString.indexOf(stringToRank) === 0) {\n return rankings.STARTS_WITH + caseRank\n }\n\n // word starts with\n if (testString.indexOf(` ${stringToRank}`) !== -1) {\n return rankings.WORD_STARTS_WITH + caseRank\n }\n\n // is a part inside a cased string\n if (isPartial) {\n return rankings.STRING_CASE + caseRank\n }\n\n // is acronym for a cased string\n if (caseRank > 0 && isCasedAcronym) {\n return rankings.STRING_CASE_ACRONYM + caseRank\n }\n\n // contains\n if (testString.indexOf(stringToRank) !== -1) {\n return rankings.CONTAINS + caseRank\n } else if (stringToRank.length === 1) {\n // If the only character in the given stringToRank\n // isn't even contained in the testString, then\n // it's definitely not a match.\n return rankings.NO_MATCH\n }\n\n // acronym\n if (getAcronym(testString).indexOf(stringToRank) !== -1) {\n return rankings.ACRONYM + caseRank\n }\n\n // will return a number between rankings.MATCHES and\n // rankings.MATCHES + 1 depending on how close of a match it is.\n return getClosenessRanking(testString, stringToRank)\n}\n\n/**\n * Generates an acronym for a string.\n *\n * @param {String} string the string for which to produce the acronym\n * @returns {String} the acronym\n */\nfunction getAcronym(string) {\n let acronym = ''\n const wordsInString = string.split(' ')\n wordsInString.forEach(wordInString => {\n const splitByHyphenWords = wordInString.split('-')\n splitByHyphenWords.forEach(splitByHyphenWord => {\n acronym += splitByHyphenWord.substr(0, 1)\n })\n })\n return acronym\n}\n\n/**\n * Returns a score base on the case of the testString\n * @param {String} testString - the string to test against\n * @returns {Number} the number of the ranking,\n * based on the case between 0 and 1 for how the testString matches the case\n */\nfunction getCaseRanking(testString) {\n const containsUpperCase = testString.toLowerCase() !== testString\n const containsDash = testString.indexOf('-') >= 0\n const containsUnderscore = testString.indexOf('_') >= 0\n\n if (!containsUpperCase && !containsUnderscore && containsDash) {\n return caseRankings.KEBAB\n }\n\n if (!containsUpperCase && containsUnderscore && !containsDash) {\n return caseRankings.SNAKE\n }\n\n if (containsUpperCase && !containsDash && !containsUnderscore) {\n const startsWithUpperCase = testString[0].toUpperCase() === testString[0]\n if (startsWithUpperCase) {\n return caseRankings.PASCAL\n }\n\n return caseRankings.CAMEL\n }\n\n return caseRankings.NO_CASE\n}\n\n/**\n * Returns whether the stringToRank is one of the case parts in the testString (works with any string case)\n * @example\n * // returns true\n * isPartialOfCase('helloWorld', 'world', caseRankings.CAMEL)\n * @example\n * // returns false\n * isPartialOfCase('helloWorld', 'oworl', caseRankings.CAMEL)\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @param {Number} caseRanking - the ranking score based on case of testString\n * @returns {Boolean} whether the stringToRank is one of the case parts in the testString\n */\nfunction isPartialOfCase(testString, stringToRank, caseRanking) {\n const testIndex = testString.toLowerCase().indexOf(stringToRank.toLowerCase())\n\n switch (caseRanking) {\n case caseRankings.SNAKE:\n return testString[testIndex - 1] === '_'\n case caseRankings.KEBAB:\n return testString[testIndex - 1] === '-'\n case caseRankings.PASCAL:\n case caseRankings.CAMEL:\n return (\n testIndex !== -1 &&\n testString[testIndex] === testString[testIndex].toUpperCase()\n )\n default:\n return false\n }\n}\n\n/**\n * Check if stringToRank is an acronym for a partial case\n * @example\n * // returns true\n * isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE)\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the acronym to test\n * @param {Number} caseRank - the ranking of the case\n * @returns {Boolean} whether the stringToRank is an acronym for the testString\n */\nfunction isCaseAcronym(testString, stringToRank, caseRank) {\n let splitValue = null\n switch (caseRank) {\n case caseRankings.SNAKE:\n splitValue = '_'\n break\n case caseRankings.KEBAB:\n splitValue = '-'\n break\n case caseRankings.PASCAL:\n case caseRankings.CAMEL:\n splitValue = /(?=[A-Z])/\n break\n default:\n splitValue = null\n }\n\n const splitTestString = testString.split(splitValue)\n return stringToRank\n .toLowerCase()\n .split('')\n .reduce((correct, char, charIndex) => {\n const splitItem = splitTestString[charIndex]\n return correct && splitItem && splitItem[0].toLowerCase() === char\n }, true)\n}\n\n/**\n * Returns a score based on how spread apart the\n * characters from the stringToRank are within the testString.\n * A number close to rankings.MATCHES represents a loose match. A number close\n * to rankings.MATCHES + 1 represents a tighter match.\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @returns {Number} the number between rankings.MATCHES and\n * rankings.MATCHES + 1 for how well stringToRank matches testString\n */\nfunction getClosenessRanking(testString, stringToRank) {\n let matchingInOrderCharCount = 0\n let charNumber = 0\n function findMatchingCharacter(matchChar, string, index) {\n for (let j = index; j < string.length; j++) {\n const stringChar = string[j]\n if (stringChar === matchChar) {\n matchingInOrderCharCount += 1\n return j + 1\n }\n }\n return -1\n }\n function getRanking(spread) {\n const spreadPercentage = 1 / spread\n const inOrderPercentage = matchingInOrderCharCount / stringToRank.length\n const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage\n return ranking\n }\n const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0)\n if (firstIndex < 0) {\n return rankings.NO_MATCH\n }\n charNumber = firstIndex\n for (let i = 1; i < stringToRank.length; i++) {\n const matchChar = stringToRank[i]\n charNumber = findMatchingCharacter(matchChar, testString, charNumber)\n const found = charNumber > -1\n if (!found) {\n return rankings.NO_MATCH\n }\n }\n\n const spread = charNumber - firstIndex\n return getRanking(spread)\n}\n\n/**\n * Sorts items that have a rank, index, and keyIndex\n * @param {Object} a - the first item to sort\n * @param {Object} b - the second item to sort\n * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal\n */\nfunction sortRankedItems(a, b, baseSort) {\n const aFirst = -1\n const bFirst = 1\n const {rank: aRank, keyIndex: aKeyIndex} = a\n const {rank: bRank, keyIndex: bKeyIndex} = b\n const same = aRank === bRank\n if (same) {\n if (aKeyIndex === bKeyIndex) {\n // use the base sort function as a tie-breaker\n return baseSort(a, b)\n } else {\n return aKeyIndex < bKeyIndex ? aFirst : bFirst\n }\n } else {\n return aRank > bRank ? aFirst : bFirst\n }\n}\n\n/**\n * Prepares value for comparison by stringifying it, removing diacritics (if specified)\n * @param {String} value - the value to clean\n * @param {Object} options - {keepDiacritics: whether to remove diacritics}\n * @return {String} the prepared value\n */\nfunction prepareValueForComparison(value, {keepDiacritics}) {\n value = `${value}` // toString\n if (!keepDiacritics) {\n value = removeAccents(value)\n }\n return value\n}\n\n/**\n * Gets value for key in item at arbitrarily nested keypath\n * @param {Object} item - the item\n * @param {Object|Function} key - the potentially nested keypath or property callback\n * @return {Array} - an array containing the value(s) at the nested keypath\n */\nfunction getItemValues(item, key) {\n if (typeof key === 'object') {\n key = key.key\n }\n let value\n if (typeof key === 'function') {\n value = key(item)\n // eslint-disable-next-line no-negated-condition\n } else if (key.indexOf('.') !== -1) {\n // handle nested keys\n value = key\n .split('.')\n .reduce(\n (itemObj, nestedKey) => (itemObj ? itemObj[nestedKey] : null),\n item,\n )\n } else {\n value = item[key]\n }\n // concat because `value` can be a string or an array\n // eslint-disable-next-line\n return value != null ? [].concat(value) : null\n}\n\n/**\n * Gets all the values for the given keys in the given item and returns an array of those values\n * @param {Object} item - the item from which the values will be retrieved\n * @param {Array} keys - the keys to use to retrieve the values\n * @return {Array} objects with {itemValue, attributes}\n */\nfunction getAllValuesToRank(item, keys) {\n return keys.reduce((allVals, key) => {\n const values = getItemValues(item, key)\n if (values) {\n values.forEach(itemValue => {\n allVals.push({\n itemValue,\n attributes: getKeyAttributes(key),\n })\n })\n }\n return allVals\n }, [])\n}\n\n/**\n * Gets all the attributes for the given key\n * @param {Object|String} key - the key from which the attributes will be retrieved\n * @return {Object} object containing the key's attributes\n */\nfunction getKeyAttributes(key) {\n if (typeof key === 'string') {\n key = {key}\n }\n return {\n maxRanking: Infinity,\n minRanking: -Infinity,\n ...key,\n }\n}\n\nexport default matchSorter\nexport {rankings}\n"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","characterMap","chars","keys","join","allAccents","RegExp","firstAccent","removeAccents","string","replace","match","hasAccents","rankings","CASE_SENSITIVE_EQUAL","EQUAL","STARTS_WITH","WORD_STARTS_WITH","STRING_CASE","STRING_CASE_ACRONYM","CONTAINS","ACRONYM","MATCHES","NO_MATCH","caseRankings","CAMEL","PASCAL","KEBAB","SNAKE","NO_CASE","matchSorter","defaultBaseSortFn","a","b","String","rankedItem","localeCompare","items","value","options","threshold","baseSort","matchedItems","reduce","reduceItemsToRanked","sort","sortRankedItems","map","item","matches","index","getHighestRanking","rank","keyIndex","keyThreshold","push","getMatchRanking","valuesToRank","getAllValuesToRank","itemValue","attributes","newRank","newRankedItem","minRanking","maxRanking","testString","stringToRank","prepareValueForComparison","caseRank","getCaseRanking","isPartial","isPartialOfCase","isCasedAcronym","isCaseAcronym","toLowerCase","indexOf","getAcronym","getClosenessRanking","acronym","wordsInString","split","forEach","wordInString","splitByHyphenWords","splitByHyphenWord","substr","containsUpperCase","containsDash","containsUnderscore","startsWithUpperCase","toUpperCase","caseRanking","testIndex","splitValue","splitTestString","correct","char","charIndex","splitItem","matchingInOrderCharCount","charNumber","findMatchingCharacter","matchChar","j","stringChar","getRanking","spread","inOrderPercentage","ranking","firstIndex","found","aFirst","bFirst","aRank","aKeyIndex","bRank","bKeyIndex","keepDiacritics","getItemValues","itemObj","nestedKey","concat","allVals","values","getKeyAttributes","Infinity"],"mappings":";;;;;;EAAe,SAASA,QAAT,GAAoB;EACjCA,EAAAA,QAAQ,GAAGC,MAAM,CAACC,MAAP,IAAiB,UAAUC,MAAV,EAAkB;EAC5C,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGC,S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 dist/match-sorter.umd.min.jsnu �Iw�� !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).matchSorter={})}(this,(function(e){"use strict";function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}var r={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z"},t=Object.keys(r).join("|"),a=new RegExp(t,"g"),u=new RegExp(t,""),o=function(e){return e.replace(a,(function(e){return r[e]}))},i=o,A=function(e){return!!e.match(u)},c=o;i.has=A,i.remove=c;var f={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},s={CAMEL:.8,PASCAL:.6,KEBAB:.4,SNAKE:.2,NO_CASE:0};d.rankings=f,d.caseRankings=s;var E=function(e,n){return String(e.rankedItem).localeCompare(n.rankedItem)};function d(e,n,r){void 0===r&&(r={});var t=r,a=t.keys,u=t.threshold,o=void 0===u?f.MATCHES:u,i=t.baseSort,A=void 0===i?E:i;return e.reduce((function(e,t,u){var i=function(e,n,r,t){if(!n)return{rankedItem:e,rank:l(e,r,t),keyIndex:-1,keyThreshold:t.threshold};return function(e,n){return n.reduce((function(n,r){var t=function(e,n){"object"==typeof n&&(n=n.key);var r;r="function"==typeof n?n(e):-1!==n.indexOf(".")?n.split(".").reduce((function(e,n){return e?e[n]:null}),e):e[n];return null!=r?[].concat(r):null}(e,r);return t&&t.forEach((function(e){n.push({itemValue:e,attributes:O(r)})})),n}),[])}(e,n).reduce((function(e,n,a){var u=e.rank,o=e.rankedItem,i=e.keyIndex,A=e.keyThreshold,c=n.itemValue,s=n.attributes,E=l(c,r,t),d=o,C=s.minRanking,O=s.maxRanking,k=s.threshold;return E<C&&E>=f.MATCHES?E=C:E>O&&(E=O),E>u&&(u=E,i=a,A=k,d=c),{rankedItem:d,rank:u,keyIndex:i,keyThreshold:A}}),{rank:f.NO_MATCH,keyIndex:-1,keyThreshold:t.threshold})}(t,a,n,r),A=i.rankedItem,c=i.rank,s=i.keyIndex,E=i.keyThreshold;c>=(void 0===E?o:E)&&e.push({rankedItem:A,item:t,rank:c,index:u,keyIndex:s});return e}),[]).sort((function(e,n){return function(e,n,r){var t=-1,a=1,u=e.rank,o=e.keyIndex,i=n.rank,A=n.keyIndex;return u===i?o===A?r(e,n):o<A?t:a:u>i?t:a}(e,n,A)})).map((function(e){return e.item}))}function l(e,n,r){if(e=C(e,r),(n=C(n,r)).length>e.length)return f.NO_MATCH;if(e===n)return f.CASE_SENSITIVE_EQUAL;var t,a,u=function(e){var n=e.toLowerCase()!==e,r=e.indexOf("-")>=0,t=e.indexOf("_")>=0;if(!n&&!t&&r)return s.KEBAB;if(!n&&t&&!r)return s.SNAKE;if(n&&!r&&!t){return e[0].toUpperCase()===e[0]?s.PASCAL:s.CAMEL}return s.NO_CASE}(e),o=function(e,n,r){var t=e.toLowerCase().indexOf(n.toLowerCase());switch(r){case s.SNAKE:return"_"===e[t-1];case s.KEBAB:return"-"===e[t-1];case s.PASCAL:case s.CAMEL:return-1!==t&&e[t]===e[t].toUpperCase();default:return!1}}(e,n,u),i=function(e,n,r){var t=null;switch(r){case s.SNAKE:t="_";break;case s.KEBAB:t="-";break;case s.PASCAL:case s.CAMEL:t=/(?=[A-Z])/;break;default:t=null}var a=e.split(t);return n.toLowerCase().split("").reduce((function(e,n,r){var t=a[r];return e&&t&&t[0].toLowerCase()===n}),!0)}(e,n,u);return(e=e.toLowerCase())===(n=n.toLowerCase())?f.EQUAL+u:0===e.indexOf(n)?f.STARTS_WITH+u:-1!==e.indexOf(" "+n)?f.WORD_STARTS_WITH+u:o?f.STRING_CASE+u:u>0&&i?f.STRING_CASE_ACRONYM+u:-1!==e.indexOf(n)?f.CONTAINS+u:1===n.length?f.NO_MATCH:-1!==(t=e,a="",t.split(" ").forEach((function(e){e.split("-").forEach((function(e){a+=e.substr(0,1)}))})),a).indexOf(n)?f.ACRONYM+u:function(e,n){var r=0,t=0;function a(e,n,t){for(var a=t;a<n.length;a++){if(n[a]===e)return r+=1,a+1}return-1}function u(e){var t=r/n.length;return f.MATCHES+t*(1/e)}var o=a(n[0],e,0);if(o<0)return f.NO_MATCH;t=o;for(var i=1;i<n.length;i++){if(!((t=a(n[i],e,t))>-1))return f.NO_MATCH}return u(t-o)}(e,n)}function C(e,n){return e=""+e,n.keepDiacritics||(e=i(e)),e}function O(e){return"string"==typeof e&&(e={key:e}),n({maxRanking:1/0,minRanking:-1/0},e)}e.default=d,e.rankings=f,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=match-sorter.umd.min.js.map PK k�}[��Y0�{ �{ dist/match-sorter.umd.min.js.mapnu �Iw�� {"version":3,"file":"match-sorter.umd.min.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/remove-accents/index.js","../src/index.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","var characterMap = {\r\n\t\"À\": \"A\",\r\n\t\"Á\": \"A\",\r\n\t\"Â\": \"A\",\r\n\t\"Ã\": \"A\",\r\n\t\"Ä\": \"A\",\r\n\t\"Å\": \"A\",\r\n\t\"Ấ\": \"A\",\r\n\t\"Ắ\": \"A\",\r\n\t\"Ẳ\": \"A\",\r\n\t\"Ẵ\": \"A\",\r\n\t\"Ặ\": \"A\",\r\n\t\"Æ\": \"AE\",\r\n\t\"Ầ\": \"A\",\r\n\t\"Ằ\": \"A\",\r\n\t\"Ȃ\": \"A\",\r\n\t\"Ç\": \"C\",\r\n\t\"Ḉ\": \"C\",\r\n\t\"È\": \"E\",\r\n\t\"É\": \"E\",\r\n\t\"Ê\": \"E\",\r\n\t\"Ë\": \"E\",\r\n\t\"Ế\": \"E\",\r\n\t\"Ḗ\": \"E\",\r\n\t\"Ề\": \"E\",\r\n\t\"Ḕ\": \"E\",\r\n\t\"Ḝ\": \"E\",\r\n\t\"Ȇ\": \"E\",\r\n\t\"Ì\": \"I\",\r\n\t\"Í\": \"I\",\r\n\t\"Î\": \"I\",\r\n\t\"Ï\": \"I\",\r\n\t\"Ḯ\": \"I\",\r\n\t\"Ȋ\": \"I\",\r\n\t\"Ð\": \"D\",\r\n\t\"Ñ\": \"N\",\r\n\t\"Ò\": \"O\",\r\n\t\"Ó\": \"O\",\r\n\t\"Ô\": \"O\",\r\n\t\"Õ\": \"O\",\r\n\t\"Ö\": \"O\",\r\n\t\"Ø\": \"O\",\r\n\t\"Ố\": \"O\",\r\n\t\"Ṍ\": \"O\",\r\n\t\"Ṓ\": \"O\",\r\n\t\"Ȏ\": \"O\",\r\n\t\"Ù\": \"U\",\r\n\t\"Ú\": \"U\",\r\n\t\"Û\": \"U\",\r\n\t\"Ü\": \"U\",\r\n\t\"Ý\": \"Y\",\r\n\t\"à\": \"a\",\r\n\t\"á\": \"a\",\r\n\t\"â\": \"a\",\r\n\t\"ã\": \"a\",\r\n\t\"ä\": \"a\",\r\n\t\"å\": \"a\",\r\n\t\"ấ\": \"a\",\r\n\t\"ắ\": \"a\",\r\n\t\"ẳ\": \"a\",\r\n\t\"ẵ\": \"a\",\r\n\t\"ặ\": \"a\",\r\n\t\"æ\": \"ae\",\r\n\t\"ầ\": \"a\",\r\n\t\"ằ\": \"a\",\r\n\t\"ȃ\": \"a\",\r\n\t\"ç\": \"c\",\r\n\t\"ḉ\": \"c\",\r\n\t\"è\": \"e\",\r\n\t\"é\": \"e\",\r\n\t\"ê\": \"e\",\r\n\t\"ë\": \"e\",\r\n\t\"ế\": \"e\",\r\n\t\"ḗ\": \"e\",\r\n\t\"ề\": \"e\",\r\n\t\"ḕ\": \"e\",\r\n\t\"ḝ\": \"e\",\r\n\t\"ȇ\": \"e\",\r\n\t\"ì\": \"i\",\r\n\t\"í\": \"i\",\r\n\t\"î\": \"i\",\r\n\t\"ï\": \"i\",\r\n\t\"ḯ\": \"i\",\r\n\t\"ȋ\": \"i\",\r\n\t\"ð\": \"d\",\r\n\t\"ñ\": \"n\",\r\n\t\"ò\": \"o\",\r\n\t\"ó\": \"o\",\r\n\t\"ô\": \"o\",\r\n\t\"õ\": \"o\",\r\n\t\"ö\": \"o\",\r\n\t\"ø\": \"o\",\r\n\t\"ố\": \"o\",\r\n\t\"ṍ\": \"o\",\r\n\t\"ṓ\": \"o\",\r\n\t\"ȏ\": \"o\",\r\n\t\"ù\": \"u\",\r\n\t\"ú\": \"u\",\r\n\t\"û\": \"u\",\r\n\t\"ü\": \"u\",\r\n\t\"ý\": \"y\",\r\n\t\"ÿ\": \"y\",\r\n\t\"Ā\": \"A\",\r\n\t\"ā\": \"a\",\r\n\t\"Ă\": \"A\",\r\n\t\"ă\": \"a\",\r\n\t\"Ą\": \"A\",\r\n\t\"ą\": \"a\",\r\n\t\"Ć\": \"C\",\r\n\t\"ć\": \"c\",\r\n\t\"Ĉ\": \"C\",\r\n\t\"ĉ\": \"c\",\r\n\t\"Ċ\": \"C\",\r\n\t\"ċ\": \"c\",\r\n\t\"Č\": \"C\",\r\n\t\"č\": \"c\",\r\n\t\"C̆\": \"C\",\r\n\t\"c̆\": \"c\",\r\n\t\"Ď\": \"D\",\r\n\t\"ď\": \"d\",\r\n\t\"Đ\": \"D\",\r\n\t\"đ\": \"d\",\r\n\t\"Ē\": \"E\",\r\n\t\"ē\": \"e\",\r\n\t\"Ĕ\": \"E\",\r\n\t\"ĕ\": \"e\",\r\n\t\"Ė\": \"E\",\r\n\t\"ė\": \"e\",\r\n\t\"Ę\": \"E\",\r\n\t\"ę\": \"e\",\r\n\t\"Ě\": \"E\",\r\n\t\"ě\": \"e\",\r\n\t\"Ĝ\": \"G\",\r\n\t\"Ǵ\": \"G\",\r\n\t\"ĝ\": \"g\",\r\n\t\"ǵ\": \"g\",\r\n\t\"Ğ\": \"G\",\r\n\t\"ğ\": \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n\t\"Ŏ\": \"O\",\r\n\t\"ŏ\": \"o\",\r\n\t\"Ő\": \"O\",\r\n\t\"ő\": \"o\",\r\n\t\"Œ\": \"OE\",\r\n\t\"œ\": \"oe\",\r\n\t\"P̆\": \"P\",\r\n\t\"p̆\": \"p\",\r\n\t\"Ŕ\": \"R\",\r\n\t\"ŕ\": \"r\",\r\n\t\"Ŗ\": \"R\",\r\n\t\"ŗ\": \"r\",\r\n\t\"Ř\": \"R\",\r\n\t\"ř\": \"r\",\r\n\t\"R̆\": \"R\",\r\n\t\"r̆\": \"r\",\r\n\t\"Ȓ\": \"R\",\r\n\t\"ȓ\": \"r\",\r\n\t\"Ś\": \"S\",\r\n\t\"ś\": \"s\",\r\n\t\"Ŝ\": \"S\",\r\n\t\"ŝ\": \"s\",\r\n\t\"Ş\": \"S\",\r\n\t\"Ș\": \"S\",\r\n\t\"ș\": \"s\",\r\n\t\"ş\": \"s\",\r\n\t\"Š\": \"S\",\r\n\t\"š\": \"s\",\r\n\t\"Ţ\": \"T\",\r\n\t\"ţ\": \"t\",\r\n\t\"ț\": \"t\",\r\n\t\"Ț\": \"T\",\r\n\t\"Ť\": \"T\",\r\n\t\"ť\": \"t\",\r\n\t\"Ŧ\": \"T\",\r\n\t\"ŧ\": \"t\",\r\n\t\"T̆\": \"T\",\r\n\t\"t̆\": \"t\",\r\n\t\"Ũ\": \"U\",\r\n\t\"ũ\": \"u\",\r\n\t\"Ū\": \"U\",\r\n\t\"ū\": \"u\",\r\n\t\"Ŭ\": \"U\",\r\n\t\"ŭ\": \"u\",\r\n\t\"Ů\": \"U\",\r\n\t\"ů\": \"u\",\r\n\t\"Ű\": \"U\",\r\n\t\"ű\": \"u\",\r\n\t\"Ų\": \"U\",\r\n\t\"ų\": \"u\",\r\n\t\"Ȗ\": \"U\",\r\n\t\"ȗ\": \"u\",\r\n\t\"V̆\": \"V\",\r\n\t\"v̆\": \"v\",\r\n\t\"Ŵ\": \"W\",\r\n\t\"ŵ\": \"w\",\r\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",\r\n\t\"p̌\": \"p\",\r\n\t\"Q̌\": \"Q\",\r\n\t\"q̌\": \"q\",\r\n\t\"Ř̩\": \"R\",\r\n\t\"ř̩\": \"r\",\r\n\t\"Ṧ\": \"S\",\r\n\t\"ṧ\": \"s\",\r\n\t\"V̌\": \"V\",\r\n\t\"v̌\": \"v\",\r\n\t\"W̌\": \"W\",\r\n\t\"w̌\": \"w\",\r\n\t\"X̌\": \"X\",\r\n\t\"x̌\": \"x\",\r\n\t\"Y̌\": \"Y\",\r\n\t\"y̌\": \"y\",\r\n\t\"A̧\": \"A\",\r\n\t\"a̧\": \"a\",\r\n\t\"B̧\": \"B\",\r\n\t\"b̧\": \"b\",\r\n\t\"Ḑ\": \"D\",\r\n\t\"ḑ\": \"d\",\r\n\t\"Ȩ\": \"E\",\r\n\t\"ȩ\": \"e\",\r\n\t\"Ɛ̧\": \"E\",\r\n\t\"ɛ̧\": \"e\",\r\n\t\"Ḩ\": \"H\",\r\n\t\"ḩ\": \"h\",\r\n\t\"I̧\": \"I\",\r\n\t\"i̧\": \"i\",\r\n\t\"Ɨ̧\": \"I\",\r\n\t\"ɨ̧\": \"i\",\r\n\t\"M̧\": \"M\",\r\n\t\"m̧\": \"m\",\r\n\t\"O̧\": \"O\",\r\n\t\"o̧\": \"o\",\r\n\t\"Q̧\": \"Q\",\r\n\t\"q̧\": \"q\",\r\n\t\"U̧\": \"U\",\r\n\t\"u̧\": \"u\",\r\n\t\"X̧\": \"X\",\r\n\t\"x̧\": \"x\",\r\n\t\"Z̧\": \"Z\",\r\n\t\"z̧\": \"z\",\r\n};\r\n\r\nvar chars = Object.keys(characterMap).join('|');\r\nvar allAccents = new RegExp(chars, 'g');\r\nvar firstAccent = new RegExp(chars, '');\r\n\r\nvar removeAccents = function(string) {\t\r\n\treturn string.replace(allAccents, function(match) {\r\n\t\treturn characterMap[match];\r\n\t});\r\n};\r\n\r\nvar hasAccents = function(string) {\r\n\treturn !!string.match(firstAccent);\r\n};\r\n\r\nmodule.exports = removeAccents;\r\nmodule.exports.has = hasAccents;\r\nmodule.exports.remove = removeAccents;\r\n","/**\n * @name match-sorter\n * @license MIT license.\n * @copyright (c) 2019 Kent C. Dodds\n * @author Kent C. Dodds <kent@doddsfamily.us>\n */\nimport removeAccents from 'remove-accents'\n\nconst rankings = {\n CASE_SENSITIVE_EQUAL: 9,\n EQUAL: 8,\n STARTS_WITH: 7,\n WORD_STARTS_WITH: 6,\n STRING_CASE: 5,\n STRING_CASE_ACRONYM: 4,\n CONTAINS: 3,\n ACRONYM: 2,\n MATCHES: 1,\n NO_MATCH: 0,\n}\n\nconst caseRankings = {\n CAMEL: 0.8,\n PASCAL: 0.6,\n KEBAB: 0.4,\n SNAKE: 0.2,\n NO_CASE: 0,\n}\n\nmatchSorter.rankings = rankings\nmatchSorter.caseRankings = caseRankings\n\nconst defaultBaseSortFn = (a, b) =>\n String(a.rankedItem).localeCompare(b.rankedItem)\n\n/**\n * Takes an array of items and a value and returns a new array with the items that match the given value\n * @param {Array} items - the items to sort\n * @param {String} value - the value to use for ranking\n * @param {Object} options - Some options to configure the sorter\n * @return {Array} - the new sorted array\n */\nfunction matchSorter(items, value, options = {}) {\n const {\n keys,\n threshold = rankings.MATCHES,\n baseSort = defaultBaseSortFn,\n } = options\n const matchedItems = items.reduce(reduceItemsToRanked, [])\n return matchedItems\n .sort((a, b) => sortRankedItems(a, b, baseSort))\n .map(({item}) => item)\n\n function reduceItemsToRanked(matches, item, index) {\n const {\n rankedItem,\n rank,\n keyIndex,\n keyThreshold = threshold,\n } = getHighestRanking(item, keys, value, options)\n if (rank >= keyThreshold) {\n matches.push({rankedItem, item, rank, index, keyIndex})\n }\n return matches\n }\n}\n\n/**\n * Gets the highest ranking for value for the given item based on its values for the given keys\n * @param {*} item - the item to rank\n * @param {Array} keys - the keys to get values from the item for the ranking\n * @param {String} value - the value to rank against\n * @param {Object} options - options to control the ranking\n * @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking\n */\nfunction getHighestRanking(item, keys, value, options) {\n if (!keys) {\n return {\n // ends up being duplicate of 'item' in matches but consistent\n rankedItem: item,\n rank: getMatchRanking(item, value, options),\n keyIndex: -1,\n keyThreshold: options.threshold,\n }\n }\n const valuesToRank = getAllValuesToRank(item, keys)\n return valuesToRank.reduce(\n (\n {rank, rankedItem, keyIndex, keyThreshold},\n {itemValue, attributes},\n i,\n ) => {\n let newRank = getMatchRanking(itemValue, value, options)\n let newRankedItem = rankedItem\n const {minRanking, maxRanking, threshold} = attributes\n if (newRank < minRanking && newRank >= rankings.MATCHES) {\n newRank = minRanking\n } else if (newRank > maxRanking) {\n newRank = maxRanking\n }\n if (newRank > rank) {\n rank = newRank\n keyIndex = i\n keyThreshold = threshold\n newRankedItem = itemValue\n }\n return {rankedItem: newRankedItem, rank, keyIndex, keyThreshold}\n },\n {rank: rankings.NO_MATCH, keyIndex: -1, keyThreshold: options.threshold},\n )\n}\n\n/**\n * Gives a rankings score based on how well the two strings match.\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @param {Object} options - options for the match (like keepDiacritics for comparison)\n * @returns {Number} the ranking for how well stringToRank matches testString\n */\nfunction getMatchRanking(testString, stringToRank, options) {\n /* eslint complexity:[2, 12] */\n testString = prepareValueForComparison(testString, options)\n stringToRank = prepareValueForComparison(stringToRank, options)\n\n // too long\n if (stringToRank.length > testString.length) {\n return rankings.NO_MATCH\n }\n\n // case sensitive equals\n if (testString === stringToRank) {\n return rankings.CASE_SENSITIVE_EQUAL\n }\n\n const caseRank = getCaseRanking(testString)\n const isPartial = isPartialOfCase(testString, stringToRank, caseRank)\n const isCasedAcronym = isCaseAcronym(testString, stringToRank, caseRank)\n\n // Lower casing before further comparison\n testString = testString.toLowerCase()\n stringToRank = stringToRank.toLowerCase()\n\n // case insensitive equals\n if (testString === stringToRank) {\n return rankings.EQUAL + caseRank\n }\n\n // starts with\n if (testString.indexOf(stringToRank) === 0) {\n return rankings.STARTS_WITH + caseRank\n }\n\n // word starts with\n if (testString.indexOf(` ${stringToRank}`) !== -1) {\n return rankings.WORD_STARTS_WITH + caseRank\n }\n\n // is a part inside a cased string\n if (isPartial) {\n return rankings.STRING_CASE + caseRank\n }\n\n // is acronym for a cased string\n if (caseRank > 0 && isCasedAcronym) {\n return rankings.STRING_CASE_ACRONYM + caseRank\n }\n\n // contains\n if (testString.indexOf(stringToRank) !== -1) {\n return rankings.CONTAINS + caseRank\n } else if (stringToRank.length === 1) {\n // If the only character in the given stringToRank\n // isn't even contained in the testString, then\n // it's definitely not a match.\n return rankings.NO_MATCH\n }\n\n // acronym\n if (getAcronym(testString).indexOf(stringToRank) !== -1) {\n return rankings.ACRONYM + caseRank\n }\n\n // will return a number between rankings.MATCHES and\n // rankings.MATCHES + 1 depending on how close of a match it is.\n return getClosenessRanking(testString, stringToRank)\n}\n\n/**\n * Generates an acronym for a string.\n *\n * @param {String} string the string for which to produce the acronym\n * @returns {String} the acronym\n */\nfunction getAcronym(string) {\n let acronym = ''\n const wordsInString = string.split(' ')\n wordsInString.forEach(wordInString => {\n const splitByHyphenWords = wordInString.split('-')\n splitByHyphenWords.forEach(splitByHyphenWord => {\n acronym += splitByHyphenWord.substr(0, 1)\n })\n })\n return acronym\n}\n\n/**\n * Returns a score base on the case of the testString\n * @param {String} testString - the string to test against\n * @returns {Number} the number of the ranking,\n * based on the case between 0 and 1 for how the testString matches the case\n */\nfunction getCaseRanking(testString) {\n const containsUpperCase = testString.toLowerCase() !== testString\n const containsDash = testString.indexOf('-') >= 0\n const containsUnderscore = testString.indexOf('_') >= 0\n\n if (!containsUpperCase && !containsUnderscore && containsDash) {\n return caseRankings.KEBAB\n }\n\n if (!containsUpperCase && containsUnderscore && !containsDash) {\n return caseRankings.SNAKE\n }\n\n if (containsUpperCase && !containsDash && !containsUnderscore) {\n const startsWithUpperCase = testString[0].toUpperCase() === testString[0]\n if (startsWithUpperCase) {\n return caseRankings.PASCAL\n }\n\n return caseRankings.CAMEL\n }\n\n return caseRankings.NO_CASE\n}\n\n/**\n * Returns whether the stringToRank is one of the case parts in the testString (works with any string case)\n * @example\n * // returns true\n * isPartialOfCase('helloWorld', 'world', caseRankings.CAMEL)\n * @example\n * // returns false\n * isPartialOfCase('helloWorld', 'oworl', caseRankings.CAMEL)\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @param {Number} caseRanking - the ranking score based on case of testString\n * @returns {Boolean} whether the stringToRank is one of the case parts in the testString\n */\nfunction isPartialOfCase(testString, stringToRank, caseRanking) {\n const testIndex = testString.toLowerCase().indexOf(stringToRank.toLowerCase())\n\n switch (caseRanking) {\n case caseRankings.SNAKE:\n return testString[testIndex - 1] === '_'\n case caseRankings.KEBAB:\n return testString[testIndex - 1] === '-'\n case caseRankings.PASCAL:\n case caseRankings.CAMEL:\n return (\n testIndex !== -1 &&\n testString[testIndex] === testString[testIndex].toUpperCase()\n )\n default:\n return false\n }\n}\n\n/**\n * Check if stringToRank is an acronym for a partial case\n * @example\n * // returns true\n * isCaseAcronym('super_duper_file', 'sdf', caseRankings.SNAKE)\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the acronym to test\n * @param {Number} caseRank - the ranking of the case\n * @returns {Boolean} whether the stringToRank is an acronym for the testString\n */\nfunction isCaseAcronym(testString, stringToRank, caseRank) {\n let splitValue = null\n switch (caseRank) {\n case caseRankings.SNAKE:\n splitValue = '_'\n break\n case caseRankings.KEBAB:\n splitValue = '-'\n break\n case caseRankings.PASCAL:\n case caseRankings.CAMEL:\n splitValue = /(?=[A-Z])/\n break\n default:\n splitValue = null\n }\n\n const splitTestString = testString.split(splitValue)\n return stringToRank\n .toLowerCase()\n .split('')\n .reduce((correct, char, charIndex) => {\n const splitItem = splitTestString[charIndex]\n return correct && splitItem && splitItem[0].toLowerCase() === char\n }, true)\n}\n\n/**\n * Returns a score based on how spread apart the\n * characters from the stringToRank are within the testString.\n * A number close to rankings.MATCHES represents a loose match. A number close\n * to rankings.MATCHES + 1 represents a tighter match.\n * @param {String} testString - the string to test against\n * @param {String} stringToRank - the string to rank\n * @returns {Number} the number between rankings.MATCHES and\n * rankings.MATCHES + 1 for how well stringToRank matches testString\n */\nfunction getClosenessRanking(testString, stringToRank) {\n let matchingInOrderCharCount = 0\n let charNumber = 0\n function findMatchingCharacter(matchChar, string, index) {\n for (let j = index; j < string.length; j++) {\n const stringChar = string[j]\n if (stringChar === matchChar) {\n matchingInOrderCharCount += 1\n return j + 1\n }\n }\n return -1\n }\n function getRanking(spread) {\n const spreadPercentage = 1 / spread\n const inOrderPercentage = matchingInOrderCharCount / stringToRank.length\n const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage\n return ranking\n }\n const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0)\n if (firstIndex < 0) {\n return rankings.NO_MATCH\n }\n charNumber = firstIndex\n for (let i = 1; i < stringToRank.length; i++) {\n const matchChar = stringToRank[i]\n charNumber = findMatchingCharacter(matchChar, testString, charNumber)\n const found = charNumber > -1\n if (!found) {\n return rankings.NO_MATCH\n }\n }\n\n const spread = charNumber - firstIndex\n return getRanking(spread)\n}\n\n/**\n * Sorts items that have a rank, index, and keyIndex\n * @param {Object} a - the first item to sort\n * @param {Object} b - the second item to sort\n * @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal\n */\nfunction sortRankedItems(a, b, baseSort) {\n const aFirst = -1\n const bFirst = 1\n const {rank: aRank, keyIndex: aKeyIndex} = a\n const {rank: bRank, keyIndex: bKeyIndex} = b\n const same = aRank === bRank\n if (same) {\n if (aKeyIndex === bKeyIndex) {\n // use the base sort function as a tie-breaker\n return baseSort(a, b)\n } else {\n return aKeyIndex < bKeyIndex ? aFirst : bFirst\n }\n } else {\n return aRank > bRank ? aFirst : bFirst\n }\n}\n\n/**\n * Prepares value for comparison by stringifying it, removing diacritics (if specified)\n * @param {String} value - the value to clean\n * @param {Object} options - {keepDiacritics: whether to remove diacritics}\n * @return {String} the prepared value\n */\nfunction prepareValueForComparison(value, {keepDiacritics}) {\n value = `${value}` // toString\n if (!keepDiacritics) {\n value = removeAccents(value)\n }\n return value\n}\n\n/**\n * Gets value for key in item at arbitrarily nested keypath\n * @param {Object} item - the item\n * @param {Object|Function} key - the potentially nested keypath or property callback\n * @return {Array} - an array containing the value(s) at the nested keypath\n */\nfunction getItemValues(item, key) {\n if (typeof key === 'object') {\n key = key.key\n }\n let value\n if (typeof key === 'function') {\n value = key(item)\n // eslint-disable-next-line no-negated-condition\n } else if (key.indexOf('.') !== -1) {\n // handle nested keys\n value = key\n .split('.')\n .reduce(\n (itemObj, nestedKey) => (itemObj ? itemObj[nestedKey] : null),\n item,\n )\n } else {\n value = item[key]\n }\n // concat because `value` can be a string or an array\n // eslint-disable-next-line\n return value != null ? [].concat(value) : null\n}\n\n/**\n * Gets all the values for the given keys in the given item and returns an array of those values\n * @param {Object} item - the item from which the values will be retrieved\n * @param {Array} keys - the keys to use to retrieve the values\n * @return {Array} objects with {itemValue, attributes}\n */\nfunction getAllValuesToRank(item, keys) {\n return keys.reduce((allVals, key) => {\n const values = getItemValues(item, key)\n if (values) {\n values.forEach(itemValue => {\n allVals.push({\n itemValue,\n attributes: getKeyAttributes(key),\n })\n })\n }\n return allVals\n }, [])\n}\n\n/**\n * Gets all the attributes for the given key\n * @param {Object|String} key - the key from which the attributes will be retrieved\n * @return {Object} object containing the key's attributes\n */\nfunction getKeyAttributes(key) {\n if (typeof key === 'string') {\n key = {key}\n }\n return {\n maxRanking: Infinity,\n minRanking: -Infinity,\n ...key,\n }\n}\n\nexport default matchSorter\nexport {rankings}\n"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","characterMap","chars","keys","join","allAccents","RegExp","firstAccent","removeAccents","string","replace","match","rankings","CASE_SENSITIVE_EQUAL","EQUAL","STARTS_WITH","WORD_STARTS_WITH","STRING_CASE","STRING_CASE_ACRONYM","CONTAINS","ACRONYM","MATCHES","NO_MATCH","caseRankings","CAMEL","PASCAL","KEBAB","SNAKE","NO_CASE","matchSorter","defaultBaseSortFn","a","b","String","rankedItem","localeCompare","items","value","options","threshold","baseSort","reduce","matches","item","index","rank","getMatchRanking","keyIndex","keyThreshold","allVals","values","indexOf","split","itemObj","nestedKey","concat","getItemValues","forEach","itemValue","push","attributes","getKeyAttributes","getAllValuesToRank","newRank","newRankedItem","minRanking","maxRanking","getHighestRanking","sort","aFirst","bFirst","aRank","aKeyIndex","bRank","bKeyIndex","sortRankedItems","map","testString","stringToRank","prepareValueForComparison","acronym","caseRank","containsUpperCase","toLowerCase","containsDash","containsUnderscore","toUpperCase","getCaseRanking","isPartial","caseRanking","testIndex","isPartialOfCase","isCasedAcronym","splitValue","splitTestString","correct","char","charIndex","splitItem","isCaseAcronym","wordInString","splitByHyphenWord","substr","matchingInOrderCharCount","charNumber","findMatchingCharacter","matchChar","j","getRanking","spread","inOrderPercentage","firstIndex","getClosenessRanking","keepDiacritics","Infinity"],"mappings":"mPAAe,SAASA,WACtBA,EAAWC,OAAOC,QAAU,SAAUC,OAC/B,IAAIC,EAAI,EAAGA,EAAIC,UAAUC,OAAQF,IAAK,KACrCG,EAASF,UAAUD,OAElB,IAAII,KAAOD,EACVN,OAAOQ,UAAUC,eAAeC,KAAKJ,EAAQC,KAC/CL,EAAOK,GAAOD,EAAOC,WAKpBL,IAGOS,MAAMC,KAAMR,WCf9B,IAAIS,EAAe,KACb,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,SACA,UACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACA,SACA,QACA,QACA,SACA,SACA,QACA,QACA,QACA,SACC,SACA,QACD,QACA,QACA,QACA,SACC,SACA,SACA,SACA,SACA,SACA,QACD,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,SACC,SACA,SACA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kF,EAAaO,MACR,IAAIxH,EAAI,EAAGA,EAAIuF,EAAarF,OAAQF,IAAK,OAE5CiH,EAAaC,EADK3B,EAAavF,GACesF,EAAY2B,KAC9B,UAEnB5F,EAASU,gBAKbsF,EADQJ,EAAaO,GApKrBC,CAAoBnC,EAAYC,GAsMzC,SAASC,EAA0B1C,YACjCA,KAAWA,IAD8B4E,iBAGvC5E,EAAQ7B,EAAc6B,IAEjBA,EA2DT,SAASwB,EAAiBlE,SACL,iBAARA,IACTA,EAAM,CAACA,IAAAA,OAGPuE,WAAYgD,EAAAA,EACZjD,YAAaiD,EAAAA,GACVvH"}PK k�}[#�/� � CHANGELOG.mdnu �Iw�� # CHANGELOG The changelog is automatically updated using [semantic-release](https://github.com/semantic-release/semantic-release). You can see it on the [releases page](../../releases). PK k�}[J��-7 7 LICENSEnu �Iw�� The MIT License (MIT) Copyright (c) 2017 Kent C. Dodds Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK k�}[�cQ�\ �\ README.mdnu �Iw�� <div align="center"> <h1>match-sorter</h1> <p>Simple, expected, and deterministic best-match sorting of an array in JavaScript</p> </div> --- **[Demo](https://codesandbox.io/s/wyk856yo48)** <!-- prettier-ignore-start --> [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> [](#contributors-) <!-- ALL-CONTRIBUTORS-BADGE:END --> [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] [![Examples][examples-badge]][examples] <!-- prettier-ignore-end --> ## The problem 1. You have a list of dozens, hundreds, or thousands of items 2. You want to filter and sort those items intelligently (maybe you have a filter input for the user) 3. You want simple, expected, and deterministic sorting of the items (no fancy math algorithm that fancily changes the sorting as they type) ## This solution This follows a simple and sensible (user friendly) algorithm that makes it easy for you to filter and sort a list of items based on given input. Items are ranked based on sensible criteria that result in a better user experience. To explain the ranking system, I'll use countries as an example: 1. **CASE SENSITIVE EQUALS**: Case-sensitive equality trumps all. These will be first. (ex. `France` would match `France`, but not `france`) 2. **EQUALS**: Case-insensitive equality (ex. `France` would match `france`) 3. **STARTS WITH**: If the item starts with the given value (ex. `Sou` would match `South Korea` or `South Africa`) 4. **WORD STARTS WITH**: If the item has multiple words, then if one of those words starts with the given value (ex. `Repub` would match `Dominican Republic`) 5. **CASE STARTS WITH**: If the item has a defined case (`camelCase`, `PascalCase`, `snake_case` or `kebab-case`), then if one of the parts starts with the given value (ex. `kingdom` would match `unitedKingdom` or `united_kingdom`) 6. **CASE ACRONYM** If the item's case matches the synonym (ex. `uk` would match `united-kingdom` or `UnitedKingdom`) 7. **CONTAINS**: If the item contains the given value (ex. `ham` would match `Bahamas`) 8. **ACRONYM**: If the item's acronym is the given value (ex. `us` would match `United States`) 9. **SIMPLE MATCH**: If the item has letters in the same order as the letters of the given value (ex. `iw` would match `Zimbabwe`, but not `Kuwait` because it must be in the same order). Furthermore, if the item is a closer match, it will rank higher (ex. `ua` matches `Uruguay` more closely than `United States of America`, therefore `Uruguay` will be ordered before `United States of America`) This ranking seems to make sense in people's minds. At least it does in mine. Feedback welcome! <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> - [Installation](#installation) - [Usage](#usage) - [Advanced options](#advanced-options) - [keys: `[string]`](#keys-string) - [threshold: `number`](#threshold-number) - [keepDiacritics: `boolean`](#keepdiacritics-boolean) - [baseSort: `function(itemA, itemB): -1 | 0 | 1`](#basesort-functionitema-itemb--1--0--1) - [Using ES6?](#using-es6) - [Inspiration](#inspiration) - [Other Solutions](#other-solutions) - [Issues](#issues) - [🐛 Bugs](#-bugs) - [💡 Feature Requests](#-feature-requests) - [Contributors ✨](#contributors-) - [LICENSE](#license) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Installation This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's `dependencies`: ``` npm install match-sorter ``` ## Usage ```javascript import matchSorter from 'match-sorter' // or const matchSorter = require('match-sorter').default // or window.matchSorter const list = ['hi', 'hey', 'hello', 'sup', 'yo'] matchSorter(list, 'h') // ['hello', 'hey', 'hi'] matchSorter(list, 'y') // ['yo', 'hey'] matchSorter(list, 'z') // [] ``` ## Advanced options ### keys: `[string]` _Default: `undefined`_ By default it just uses the value itself as above. Passing an array tells match-sorter which keys to use for the ranking. ```javascript const objList = [ {name: 'Janice', color: 'Green'}, {name: 'Fred', color: 'Orange'}, {name: 'George', color: 'Blue'}, {name: 'Jen', color: 'Red'}, ] matchSorter(objList, 'g', {keys: ['name', 'color']}) // [{name: 'George', color: 'Blue'}, {name: 'Janice', color: 'Green'}, {name: 'Fred', color: 'Orange'}] matchSorter(objList, 're', {keys: ['color', 'name']}) // [{name: 'Jen', color: 'Red'}, {name: 'Janice', color: 'Green'}, {name: 'Fred', color: 'Orange'}, {name: 'George', color: 'Blue'}] ``` **Array of values**: When the specified key matches an array of values, the best match from the values of in the array is going to be used for the ranking. ```javascript const iceCreamYum = [ {favoriteIceCream: ['mint', 'chocolate']}, {favoriteIceCream: ['candy cane', 'brownie']}, {favoriteIceCream: ['birthday cake', 'rocky road', 'strawberry']}, ] matchSorter(iceCreamYum, 'cc', {keys: ['favoriteIceCream']}) // [{favoriteIceCream: ['candy cane', 'brownie']}, {favoriteIceCream: ['mint', 'chocolate']}] ``` **Nested Keys**: You can specify nested keys using dot-notation. ```javascript const nestedObjList = [ {name: {first: 'Janice'}}, {name: {first: 'Fred'}}, {name: {first: 'George'}}, {name: {first: 'Jen'}}, ] matchSorter(nestedObjList, 'j', {keys: ['name.first']}) // [{name: {first: 'Janice'}}, {name: {first: 'Jen'}}] const nestedObjList = [ {name: [{first: 'Janice'}]}, {name: [{first: 'Fred'}]}, {name: [{first: 'George'}]}, {name: [{first: 'Jen'}]}, ] matchSorter(nestedObjList, 'j', {keys: ['name.0.first']}) // [{name: {first: 'Janice'}}, {name: {first: 'Jen'}}] // matchSorter(nestedObjList, 'j', {keys: ['name[0].first']}) does not work ``` **Property Callbacks**: Alternatively, you may also pass in a callback function that resolves the value of the key(s) you wish to match on. This is especially useful when interfacing with libraries such as Immutable.js ```javascript const list = [{name: 'Janice'}, {name: 'Fred'}, {name: 'George'}, {name: 'Jen'}] matchSorter(list, 'j', {keys: [item => item.name]}) // [{name: 'Janice'}, {name: 'Jen'}] ``` For more complex structures, expanding on the `nestedObjList` example above, you can use `map`: ```javascript const nestedObjList = [ { name: [ {first: 'Janice', last: 'Smith'}, {first: 'Jon', last: 'Doe'}, ], }, { name: [ {first: 'Fred', last: 'Astaire'}, {first: 'Jenny', last: 'Doe'}, {first: 'Wilma', last: 'Flintstone'}, ], }, ] matchSorter(nestedObjList, 'doe', { keys: [ item => item.name.map(i => i.first), item => item.name.map(i => i.last), ], }) // [name: [{ first: 'Janice', last: 'Smith' },{ first: 'Jon', last: 'Doe' }], name: [{ first: 'Fred', last: 'Astaire' },{ first: 'Jenny', last: 'Doe' },{ first: 'Wilma', last: 'Flintstone' }]] ``` **Threshold**: You may specify an individual threshold for specific keys. A key will only match if it meets the specified threshold. _For more information regarding thresholds [see below](#threshold-number)_ ```javascript const list = [ {name: 'Fred', color: 'Orange'}, {name: 'Jen', color: 'Red'}, ] matchSorter(list, 'ed', { keys: [{threshold: rankings.STARTS_WITH, key: 'name'}, 'color'], }) //[{name: 'Jen', color: 'Red'}] ``` **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` _Default: `MATCHES`_ Thresholds can be used to specify the criteria used to rank the results. Available thresholds (from top to bottom) are: - CASE_SENSITIVE_EQUAL - EQUAL - STARTS_WITH - WORD_STARTS_WITH - STRING_CASE - STRING_CASE_ACRONYM - CONTAINS - ACRONYM - MATCHES _(default value)_ - NO_MATCH ```javascript const fruit = ['orange', 'apple', 'grape', 'banana'] matchSorter(fruit, 'ap', {threshold: matchSorter.rankings.NO_MATCH}) // ['apple', 'grape', 'orange', 'banana'] (returns all items, just sorted by best match) const things = ['google', 'airbnb', 'apple', 'apply', 'app'], matchSorter(things, 'app', {threshold: matchSorter.rankings.EQUAL}) // ['app'] (only items that are equal) const otherThings = ['fiji apple', 'google', 'app', 'crabapple', 'apple', 'apply'] matchSorter(otherThings, 'app', {threshold: matchSorter.rankings.WORD_STARTS_WITH}) // ['app', 'apple', 'apply', 'fiji apple'] (everything that matches with "word starts with" or better) ``` ### keepDiacritics: `boolean` _Default: `false`_ By default, match-sorter will strip diacritics before doing any comparisons. This is the default because it makes the most sense from a UX perspective. You can disable this behavior by specifying `keepDiacritics: true` ```javascript const thingsWithDiacritics = [ 'jalapeño', 'à la carte', 'café', 'papier-mâché', 'à la mode', ] matchSorter(thingsWithDiacritics, 'aa') // ['jalapeño', 'à la carte', 'à la mode', 'papier-mâché'] matchSorter(thingsWithDiacritics, 'aa', {keepDiacritics: true}) // ['jalapeño', 'à la carte'] matchSorter(thingsWithDiacritics, 'à', {keepDiacritics: true}) // ['à la carte', 'à la mode'] ``` ### baseSort: `function(itemA, itemB): -1 | 0 | 1` _Default: `(a, b) => String(a.rankedItem).localeCompare(b.rankedItem)`_ By default, match-sorter uses the `String.localeCompare` function to tie-break items that have the same ranking. This results in a stable, alphabetic sort. ```javascript const list = ['C apple', 'B apple', 'A apple'] matchSorter(list, 'apple') // ['A apple', 'B apple', 'C apple'] ``` _You can customize this behavior by specifying a custom `baseSort` function:_ ```javascript const list = ['C apple', 'B apple', 'A apple'] // This baseSort function will use the original index of items as the tie breaker matchSorter(list, 'apple', {baseSort: (a, b) => (a.index < b.index ? -1 : 1)}) // ['C apple', 'B apple', 'A apple'] ``` ## Using ES6? In the examples above, we're using CommonJS. If you're using ES6 modules, then you can do: `import matchSorter, {rankings, caseRankings} from 'match-sorter'` ## Recipes ### Match many words across multiple fields (table filtering) By default, `match-sorter` will return matches from objects where one of the properties matches _the entire_ search term. For multi-column data sets it can be beneficial to split words in search string and match each word separately. This can be done by chaining `match-sorter` calls. The benefit of this is that a filter string of "two words" will match both "two" and "words", but will return rows where the two words are found in _different_ columns as well as when both words match in the same column. For single-column matches it will also return matches out of order (column = "wordstwo" will match just as well as column="twowords", the latter getting a higher score). ```javascript function fuzzySearchMutipleWords( rows, // array of data [{a: "a", b: "b"}, {a: "c", b: "d"}] keys, // keys to search ["a", "b"] filterValue: string, // potentially multi-word search string "two words" ) { if (!filterValue || !filterValue.length) { return rows } const terms = filterValue.split(' ') if (!terms) { return rows } // reduceRight will mean sorting is done by score for the _first_ entered word. return terms.reduceRight( (results, term) => matchSorter(results, term, {keys}), rows, ) } ``` [Multi-column code sandbox](https://codesandbox.io/s/match-sorter-example-forked-1ko35) ## Inspiration Actually, most of this code was extracted from the _very first_ library I ever wrote: [genie][genie]! ## Other Solutions You might try [Fuse.js](https://github.com/krisk/Fuse). It uses advanced math fanciness to get the closest match. Unfortunately what's "closest" doesn't always really make sense. So I extracted this from [genie][genie]. ## Issues _Looking to contribute? Look for the [Good First Issue][good-first-issue] label._ ### 🐛 Bugs Please file an issue for bugs, missing documentation, or unexpected behavior. [**See Bugs**][bugs] ### 💡 Feature Requests Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on. [**See Feature Requests**][requests] ## Contributors ✨ Thanks goes to these people ([emoji key][emojis]): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="https://kentcdodds.com"><img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt=""/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#infra-kentcdodds" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=kentcdodds" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/match-sorter/pulls?q=is%3Apr+reviewed-by%3Akentcdodds" title="Reviewed Pull Requests">👀</a></td> <td align="center"><a href="http://conorhastings.com"><img src="https://avatars.githubusercontent.com/u/8263298?v=3" width="100px;" alt=""/><br /><sub><b>Conor Hastings</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=conorhastings" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=conorhastings" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=conorhastings" title="Tests">⚠️</a> <a href="https://github.com/kentcdodds/match-sorter/pulls?q=is%3Apr+reviewed-by%3Aconorhastings" title="Reviewed Pull Requests">👀</a></td> <td align="center"><a href="https://github.com/rogeliog"><img src="https://avatars.githubusercontent.com/u/574806?v=3" width="100px;" alt=""/><br /><sub><b>Rogelio Guzman</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=rogeliog" title="Documentation">📖</a></td> <td align="center"><a href="http://ced.io"><img src="https://avatars.githubusercontent.com/u/1416436?v=3" width="100px;" alt=""/><br /><sub><b>Claudéric Demers</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=clauderic" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=clauderic" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=clauderic" title="Tests">⚠️</a></td> <td align="center"><a href="kevindav.us"><img src="https://avatars3.githubusercontent.com/u/4150097?v=3" width="100px;" alt=""/><br /><sub><b>Kevin Davis</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=osfan501" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=osfan501" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/nfdjps"><img src="https://avatars1.githubusercontent.com/u/19157735?v=3" width="100px;" alt=""/><br /><sub><b>Denver Chen</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=nfdjps" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=nfdjps" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=nfdjps" title="Tests">⚠️</a></td> <td align="center"><a href="http://ruigrok.info"><img src="https://avatars0.githubusercontent.com/u/12719057?v=4" width="100px;" alt=""/><br /><sub><b>Christian Ruigrok</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/issues?q=author%3AChrisRu" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=ChrisRu" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=ChrisRu" title="Documentation">📖</a></td> </tr> <tr> <td align="center"><a href="https://github.com/hozefaj"><img src="https://avatars1.githubusercontent.com/u/2084833?v=4" width="100px;" alt=""/><br /><sub><b>Hozefa</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/issues?q=author%3Ahozefaj" title="Bug reports">🐛</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=hozefaj" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=hozefaj" title="Tests">⚠️</a> <a href="#ideas-hozefaj" title="Ideas, Planning, & Feedback">🤔</a></td> <td align="center"><a href="https://github.com/pushpinder107"><img src="https://avatars3.githubusercontent.com/u/9403361?v=4" width="100px;" alt=""/><br /><sub><b>pushpinder107</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=pushpinder107" title="Code">💻</a></td> <td align="center"><a href="https://github.com/tikotzky"><img src="https://avatars3.githubusercontent.com/u/200528?v=4" width="100px;" alt=""/><br /><sub><b>Mordy Tikotzky</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=tikotzky" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=tikotzky" title="Documentation">📖</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=tikotzky" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/sdbrannum"><img src="https://avatars1.githubusercontent.com/u/11765845?v=4" width="100px;" alt=""/><br /><sub><b>Steven Brannum</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=sdbrannum" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/commits?author=sdbrannum" title="Tests">⚠️</a></td> <td align="center"><a href="https://github.com/cmeeren"><img src="https://avatars0.githubusercontent.com/u/7766733?v=4" width="100px;" alt=""/><br /><sub><b>Christer van der Meeren</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/issues?q=author%3Acmeeren" title="Bug reports">🐛</a></td> <td align="center"><a href="http://securitynull.net/"><img src="https://avatars0.githubusercontent.com/u/3801362?v=4" width="100px;" alt=""/><br /><sub><b>Samuel Petrosyan</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=samyan" title="Code">💻</a> <a href="https://github.com/kentcdodds/match-sorter/issues?q=author%3Asamyan" title="Bug reports">🐛</a></td> <td align="center"><a href="https://brandonkalinowski.com"><img src="https://avatars3.githubusercontent.com/u/4714862?v=4" width="100px;" alt=""/><br /><sub><b>Brandon Kalinowski</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/issues?q=author%3Abrandonkal" title="Bug reports">🐛</a></td> </tr> <tr> <td align="center"><a href="https://codefund.io"><img src="https://avatars2.githubusercontent.com/u/12481?v=4" width="100px;" alt=""/><br /><sub><b>Eric Berry</b></sub></a><br /><a href="#fundingFinding-coderberry" title="Funding Finding">🔍</a></td> <td align="center"><a href="https://github.com/skube"><img src="https://avatars3.githubusercontent.com/u/146396?v=4" width="100px;" alt=""/><br /><sub><b>Skubie Doo</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=skube" title="Documentation">📖</a></td> <td align="center"><a href="https://michaeldeboey.be"><img src="https://avatars3.githubusercontent.com/u/6643991?v=4" width="100px;" alt=""/><br /><sub><b>Michaël De Boey</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=MichaelDeBoey" title="Code">💻</a></td> <td align="center"><a href="https://tannerlinsley.com"><img src="https://avatars0.githubusercontent.com/u/5580297?v=4" width="100px;" alt=""/><br /><sub><b>Tanner Linsley</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=tannerlinsley" title="Code">💻</a></td> <td align="center"><a href="https://github.com/SweVictor"><img src="https://avatars1.githubusercontent.com/u/449347?v=4" width="100px;" alt=""/><br /><sub><b>Victor</b></sub></a><br /><a href="https://github.com/kentcdodds/match-sorter/commits?author=SweVictor" title="Documentation">📖</a></td> </tr> </table> <!-- markdownlint-enable --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END --> This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome! ## LICENSE MIT <!-- prettier-ignore-start --> [npm]: https://www.npmjs.com [node]: https://nodejs.org [build-badge]: https://img.shields.io/travis/kentcdodds/match-sorter.svg?style=flat-square [build]: https://travis-ci.org/kentcdodds/match-sorter [coverage-badge]: https://img.shields.io/codecov/c/github/kentcdodds/match-sorter.svg?style=flat-square [coverage]: https://codecov.io/github/kentcdodds/match-sorter [version-badge]: https://img.shields.io/npm/v/match-sorter.svg?style=flat-square [package]: https://www.npmjs.com/package/match-sorter [downloads-badge]: https://img.shields.io/npm/dm/match-sorter.svg?style=flat-square [npmtrends]: https://www.npmtrends.com/match-sorter [license-badge]: https://img.shields.io/npm/l/match-sorter.svg?style=flat-square [license]: https://github.com/kentcdodds/match-sorter/blob/master/other/LICENSE [prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square [prs]: http://makeapullrequest.com [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square [coc]: https://github.com/kentcdodds/match-sorter/blob/master/other/CODE_OF_CONDUCT.md [examples-badge]: https://img.shields.io/badge/%F0%9F%92%A1-examples-8C8E93.svg?style=flat-square [examples]: https://github.com/kentcdodds/match-sorter/blob/master/other/EXAMPLES.md [emojis]: https://github.com/all-contributors/all-contributors#emoji-key [all-contributors]: https://github.com/all-contributors/all-contributors [genie]: https://github.com/kentcdodds/genie <!-- prettier-ignore-end --> PK k�}[@v��� � package.jsonnu �Iw�� { "_args": [ [ "match-sorter@4.2.1", "/home/freeclou/app.optimyar.com/backend" ] ], "_from": "match-sorter@4.2.1", "_id": "match-sorter@4.2.1", "_inBundle": false, "_integrity": "sha512-s+3h9TiZU9U1pWhIERHf8/f4LmBN6IXaRgo2CI17+XGByGS1GvG5VvXK9pcGyCjGe3WM3mSYRC3ipGrd5UEVgw==", "_location": "/match-sorter", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, "raw": "match-sorter@4.2.1", "name": "match-sorter", "escapedName": "match-sorter", "rawSpec": "4.2.1", "saveSpec": null, "fetchSpec": "4.2.1" }, "_requiredBy": [ "/strapi-admin" ], "_resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-4.2.1.tgz", "_spec": "4.2.1", "_where": "/home/freeclou/app.optimyar.com/backend", "author": { "name": "Kent C. Dodds", "email": "me@kentcdodds.com", "url": "https://kentcdodds.com" }, "bugs": { "url": "https://github.com/kentcdodds/match-sorter/issues" }, "dependencies": { "@babel/runtime": "^7.10.5", "remove-accents": "0.4.2" }, "description": "Simple, expected, and deterministic best-match sorting of an array in JavaScript", "devDependencies": { "kcd-scripts": "^6.2.4" }, "eslintConfig": { "extends": [ "./node_modules/kcd-scripts/eslint.js" ] }, "eslintIgnore": [ "node_modules", "coverage", "dist" ], "files": [ "dist" ], "homepage": "https://github.com/kentcdodds/match-sorter#readme", "keywords": [ "autocomplete", "filter list", "sort", "advanced sort", "user intuitive sort" ], "license": "MIT", "main": "dist/match-sorter.cjs.js", "module": "dist/match-sorter.esm.js", "name": "match-sorter", "repository": { "type": "git", "url": "git+https://github.com/kentcdodds/match-sorter.git" }, "scripts": { "build": "kcd-scripts build --bundle --environment BUILD_NAME:matchSorter", "lint": "kcd-scripts lint", "setup": "npm install && npm run validate -s", "test": "kcd-scripts test", "test:update": "npm test -- --updateSnapshot --coverage", "validate": "kcd-scripts validate" }, "version": "4.2.1" } PK k�}[1�P�: �: dist/match-sorter.cjs.jsnu �Iw�� PK k�}[ʤ1�R9 R9 ); dist/match-sorter.esm.jsnu �Iw�� PK k�}[ϵgQ�Y �Y �t dist/match-sorter.umd.jsnu �Iw�� PK k�}[�2�Ce� e� �� dist/match-sorter.umd.js.mapnu �Iw�� PK k�}[�y� � �{ dist/match-sorter.umd.min.jsnu �Iw�� PK k�}[��Y0�{ �{ a� dist/match-sorter.umd.min.js.mapnu �Iw�� PK k�}[#�/� � j CHANGELOG.mdnu �Iw�� PK k�}[J��-7 7 a LICENSEnu �Iw�� PK k�}[�cQ�\ �\ � README.mdnu �Iw�� PK k�}[@v��� � �x package.jsonnu �Iw�� PK H _�
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.02 |
proxy
|
phpinfo
|
Настройка