@tanstack/react-query-devtools 4.0.8 → 4.0.11-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{types/react-query-devtools/src → lib}/Explorer.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/Logo.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/devtools.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/index.d.ts +0 -0
- package/build/lib/index.js +2286 -0
- package/build/lib/index.js.map +1 -0
- package/build/{esm/index.js → lib/index.mjs} +282 -3
- package/build/lib/index.mjs.map +1 -0
- package/build/{types/react-query-devtools/src → lib}/noop.d.ts +0 -0
- package/build/{cjs → lib}/noop.js +0 -0
- package/build/{cjs → lib}/noop.js.map +0 -0
- package/build/{esm/noop.js → lib/noop.mjs} +1 -1
- package/build/lib/noop.mjs.map +1 -0
- package/build/{types/react-query-devtools/src → lib}/styledComponents.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/theme.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/useLocalStorage.d.ts +0 -0
- package/build/{types/react-query-devtools/src → lib}/useMediaQuery.d.ts +0 -0
- package/build/lib/useSyncExternalStore.d.ts +1 -0
- package/build/lib/useSyncExternalStore.native.d.ts +1 -0
- package/build/{types/react-query-devtools/src → lib}/utils.d.ts +0 -0
- package/build/umd/index.development.js +2240 -9
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/build/umd/noop.development.js +30 -0
- package/build/umd/noop.development.js.map +1 -0
- package/build/umd/noop.production.js +12 -0
- package/build/umd/noop.production.js.map +1 -0
- package/cjs.fallback.js +13 -0
- package/package.json +36 -19
- package/src/devtools.tsx +1 -1
- package/src/useSyncExternalStore.native.ts +3 -0
- package/src/useSyncExternalStore.ts +2 -0
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -33
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js +0 -757
- package/build/cjs/node_modules/@tanstack/match-sorter-utils/build/esm/index.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/Explorer.js +0 -215
- package/build/cjs/packages/react-query-devtools/src/Explorer.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/Logo.js +0 -66
- package/build/cjs/packages/react-query-devtools/src/Logo.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/devtools.js +0 -805
- package/build/cjs/packages/react-query-devtools/src/devtools.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/index.js +0 -26
- package/build/cjs/packages/react-query-devtools/src/index.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/styledComponents.js +0 -113
- package/build/cjs/packages/react-query-devtools/src/styledComponents.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/theme.js +0 -68
- package/build/cjs/packages/react-query-devtools/src/theme.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js +0 -81
- package/build/cjs/packages/react-query-devtools/src/useLocalStorage.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js +0 -66
- package/build/cjs/packages/react-query-devtools/src/useMediaQuery.js.map +0 -1
- package/build/cjs/packages/react-query-devtools/src/utils.js +0 -113
- package/build/cjs/packages/react-query-devtools/src/utils.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/esm/noop.js.map +0 -1
- package/build/stats-html.html +0 -2689
- package/build/stats.json +0 -45
- package/build/types/query-core/src/focusManager.d.ts +0 -16
- package/build/types/query-core/src/hydration.d.ts +0 -34
- package/build/types/query-core/src/index.d.ts +0 -20
- package/build/types/query-core/src/infiniteQueryBehavior.d.ts +0 -15
- package/build/types/query-core/src/infiniteQueryObserver.d.ts +0 -18
- package/build/types/query-core/src/logger.d.ts +0 -8
- package/build/types/query-core/src/mutation.d.ts +0 -70
- package/build/types/query-core/src/mutationCache.d.ts +0 -52
- package/build/types/query-core/src/mutationObserver.d.ts +0 -23
- package/build/types/query-core/src/notifyManager.d.ts +0 -18
- package/build/types/query-core/src/onlineManager.d.ts +0 -16
- package/build/types/query-core/src/queriesObserver.d.ts +0 -23
- package/build/types/query-core/src/query.d.ts +0 -119
- package/build/types/query-core/src/queryCache.d.ts +0 -59
- package/build/types/query-core/src/queryClient.d.ts +0 -65
- package/build/types/query-core/src/queryObserver.d.ts +0 -61
- package/build/types/query-core/src/removable.d.ts +0 -9
- package/build/types/query-core/src/retryer.d.ts +0 -33
- package/build/types/query-core/src/subscribable.d.ts +0 -10
- package/build/types/query-core/src/types.d.ts +0 -417
- package/build/types/query-core/src/utils.d.ts +0 -99
- package/build/types/react-query/src/Hydrate.d.ts +0 -10
- package/build/types/react-query/src/QueryClientProvider.d.ts +0 -24
- package/build/types/react-query/src/QueryErrorResetBoundary.d.ts +0 -12
- package/build/types/react-query/src/index.d.ts +0 -17
- package/build/types/react-query/src/isRestoring.d.ts +0 -3
- package/build/types/react-query/src/reactBatchedUpdates.d.ts +0 -2
- package/build/types/react-query/src/setBatchUpdatesFn.d.ts +0 -1
- package/build/types/react-query/src/types.d.ts +0 -35
- package/build/types/react-query/src/useBaseQuery.d.ts +0 -3
- package/build/types/react-query/src/useInfiniteQuery.d.ts +0 -5
- package/build/types/react-query/src/useIsFetching.d.ts +0 -7
- package/build/types/react-query/src/useIsMutating.d.ts +0 -7
- package/build/types/react-query/src/useMutation.d.ts +0 -6
- package/build/types/react-query/src/useQueries.d.ts +0 -49
- package/build/types/react-query/src/useQuery.d.ts +0 -20
- package/build/types/react-query/src/utils.d.ts +0 -1
- package/build/types/react-query-devtools/src/__tests__/Explorer.test.d.ts +0 -1
- package/build/types/react-query-devtools/src/__tests__/devtools.test.d.ts +0 -6
- package/build/types/react-query-devtools/src/__tests__/utils.d.ts +0 -22
|
@@ -1,757 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* react-query-devtools
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* match-sorter-utils
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) TanStack
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
22
|
-
*
|
|
23
|
-
* @license MIT
|
|
24
|
-
*/
|
|
25
|
-
const characterMap = {
|
|
26
|
-
À: 'A',
|
|
27
|
-
Á: 'A',
|
|
28
|
-
Â: 'A',
|
|
29
|
-
Ã: 'A',
|
|
30
|
-
Ä: 'A',
|
|
31
|
-
Å: 'A',
|
|
32
|
-
Ấ: 'A',
|
|
33
|
-
Ắ: 'A',
|
|
34
|
-
Ẳ: 'A',
|
|
35
|
-
Ẵ: 'A',
|
|
36
|
-
Ặ: 'A',
|
|
37
|
-
Æ: 'AE',
|
|
38
|
-
Ầ: 'A',
|
|
39
|
-
Ằ: 'A',
|
|
40
|
-
Ȃ: 'A',
|
|
41
|
-
Ç: 'C',
|
|
42
|
-
Ḉ: 'C',
|
|
43
|
-
È: 'E',
|
|
44
|
-
É: 'E',
|
|
45
|
-
Ê: 'E',
|
|
46
|
-
Ë: 'E',
|
|
47
|
-
Ế: 'E',
|
|
48
|
-
Ḗ: 'E',
|
|
49
|
-
Ề: 'E',
|
|
50
|
-
Ḕ: 'E',
|
|
51
|
-
Ḝ: 'E',
|
|
52
|
-
Ȇ: 'E',
|
|
53
|
-
Ì: 'I',
|
|
54
|
-
Í: 'I',
|
|
55
|
-
Î: 'I',
|
|
56
|
-
Ï: 'I',
|
|
57
|
-
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 'o',
|
|
112
|
-
ó: 'o',
|
|
113
|
-
ô: 'o',
|
|
114
|
-
õ: 'o',
|
|
115
|
-
ö: 'o',
|
|
116
|
-
ø: 'o',
|
|
117
|
-
ố: 'o',
|
|
118
|
-
ṍ: 'o',
|
|
119
|
-
ṓ: 'o',
|
|
120
|
-
ȏ: 'o',
|
|
121
|
-
ù: 'u',
|
|
122
|
-
ú: 'u',
|
|
123
|
-
û: 'u',
|
|
124
|
-
ü: 'u',
|
|
125
|
-
ý: 'y',
|
|
126
|
-
ÿ: 'y',
|
|
127
|
-
Ā: 'A',
|
|
128
|
-
ā: 'a',
|
|
129
|
-
Ă: 'A',
|
|
130
|
-
ă: 'a',
|
|
131
|
-
Ą: 'A',
|
|
132
|
-
ą: 'a',
|
|
133
|
-
Ć: 'C',
|
|
134
|
-
ć: 'c',
|
|
135
|
-
Ĉ: 'C',
|
|
136
|
-
ĉ: 'c',
|
|
137
|
-
Ċ: 'C',
|
|
138
|
-
ċ: 'c',
|
|
139
|
-
Č: 'C',
|
|
140
|
-
č: 'c',
|
|
141
|
-
C̆: 'C',
|
|
142
|
-
c̆: 'c',
|
|
143
|
-
Ď: 'D',
|
|
144
|
-
ď: 'd',
|
|
145
|
-
Đ: 'D',
|
|
146
|
-
đ: 'd',
|
|
147
|
-
Ē: 'E',
|
|
148
|
-
ē: 'e',
|
|
149
|
-
Ĕ: 'E',
|
|
150
|
-
ĕ: 'e',
|
|
151
|
-
Ė: 'E',
|
|
152
|
-
ė: 'e',
|
|
153
|
-
Ę: 'E',
|
|
154
|
-
ę: 'e',
|
|
155
|
-
Ě: 'E',
|
|
156
|
-
ě: 'e',
|
|
157
|
-
Ĝ: 'G',
|
|
158
|
-
Ǵ: 'G',
|
|
159
|
-
ĝ: 'g',
|
|
160
|
-
ǵ: 'g',
|
|
161
|
-
Ğ: 'G',
|
|
162
|
-
ğ: 'g',
|
|
163
|
-
Ġ: 'G',
|
|
164
|
-
ġ: 'g',
|
|
165
|
-
Ģ: 'G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
Ŏ: 'O',
|
|
219
|
-
ŏ: 'o',
|
|
220
|
-
Ő: 'O',
|
|
221
|
-
ő: 'o',
|
|
222
|
-
Œ: 'OE',
|
|
223
|
-
œ: 'oe',
|
|
224
|
-
P̆: 'P',
|
|
225
|
-
p̆: 'p',
|
|
226
|
-
Ŕ: 'R',
|
|
227
|
-
ŕ: 'r',
|
|
228
|
-
Ŗ: 'R',
|
|
229
|
-
ŗ: 'r',
|
|
230
|
-
Ř: 'R',
|
|
231
|
-
ř: 'r',
|
|
232
|
-
R̆: 'R',
|
|
233
|
-
r̆: 'r',
|
|
234
|
-
Ȓ: 'R',
|
|
235
|
-
ȓ: 'r',
|
|
236
|
-
Ś: 'S',
|
|
237
|
-
ś: 's',
|
|
238
|
-
Ŝ: 'S',
|
|
239
|
-
ŝ: 's',
|
|
240
|
-
Ş: 'S',
|
|
241
|
-
Ș: 'S',
|
|
242
|
-
ș: 's',
|
|
243
|
-
ş: 's',
|
|
244
|
-
Š: 'S',
|
|
245
|
-
š: 's',
|
|
246
|
-
Ţ: 'T',
|
|
247
|
-
ţ: 't',
|
|
248
|
-
ț: 't',
|
|
249
|
-
Ț: 'T',
|
|
250
|
-
Ť: 'T',
|
|
251
|
-
ť: 't',
|
|
252
|
-
Ŧ: 'T',
|
|
253
|
-
ŧ: 't',
|
|
254
|
-
T̆: 'T',
|
|
255
|
-
t̆: 't',
|
|
256
|
-
Ũ: 'U',
|
|
257
|
-
ũ: 'u',
|
|
258
|
-
Ū: 'U',
|
|
259
|
-
ū: 'u',
|
|
260
|
-
Ŭ: 'U',
|
|
261
|
-
ŭ: 'u',
|
|
262
|
-
Ů: 'U',
|
|
263
|
-
ů: 'u',
|
|
264
|
-
Ű: 'U',
|
|
265
|
-
ű: 'u',
|
|
266
|
-
Ų: 'U',
|
|
267
|
-
ų: 'u',
|
|
268
|
-
Ȗ: 'U',
|
|
269
|
-
ȗ: 'u',
|
|
270
|
-
V̆: 'V',
|
|
271
|
-
v̆: 'v',
|
|
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ȟ: 'h',
|
|
375
|
-
J̌: 'J',
|
|
376
|
-
ǰ: 'j',
|
|
377
|
-
Ǩ: 'K',
|
|
378
|
-
ǩ: 'k',
|
|
379
|
-
M̌: 'M',
|
|
380
|
-
m̌: 'm',
|
|
381
|
-
P̌: 'P',
|
|
382
|
-
p̌: 'p',
|
|
383
|
-
Q̌: 'Q',
|
|
384
|
-
q̌: 'q',
|
|
385
|
-
Ř̩: 'R',
|
|
386
|
-
ř̩: 'r',
|
|
387
|
-
Ṧ: 'S',
|
|
388
|
-
ṧ: 's',
|
|
389
|
-
V̌: 'V',
|
|
390
|
-
v̌: 'v',
|
|
391
|
-
W̌: 'W',
|
|
392
|
-
w̌: 'w',
|
|
393
|
-
X̌: 'X',
|
|
394
|
-
x̌: 'x',
|
|
395
|
-
Y̌: 'Y',
|
|
396
|
-
y̌: 'y',
|
|
397
|
-
A̧: 'A',
|
|
398
|
-
a̧: 'a',
|
|
399
|
-
B̧: 'B',
|
|
400
|
-
b̧: 'b',
|
|
401
|
-
Ḑ: 'D',
|
|
402
|
-
ḑ: 'd',
|
|
403
|
-
Ȩ: 'E',
|
|
404
|
-
ȩ: 'e',
|
|
405
|
-
Ɛ̧: 'E',
|
|
406
|
-
ɛ̧: 'e',
|
|
407
|
-
Ḩ: 'H',
|
|
408
|
-
ḩ: 'h',
|
|
409
|
-
I̧: 'I',
|
|
410
|
-
i̧: 'i',
|
|
411
|
-
Ɨ̧: 'I',
|
|
412
|
-
ɨ̧: 'i',
|
|
413
|
-
M̧: 'M',
|
|
414
|
-
m̧: 'm',
|
|
415
|
-
O̧: 'O',
|
|
416
|
-
o̧: 'o',
|
|
417
|
-
Q̧: 'Q',
|
|
418
|
-
q̧: 'q',
|
|
419
|
-
U̧: 'U',
|
|
420
|
-
u̧: 'u',
|
|
421
|
-
X̧: 'X',
|
|
422
|
-
x̧: 'x',
|
|
423
|
-
Z̧: 'Z',
|
|
424
|
-
z̧: 'z'
|
|
425
|
-
};
|
|
426
|
-
const chars = Object.keys(characterMap).join('|');
|
|
427
|
-
const allAccents = new RegExp(chars, 'g');
|
|
428
|
-
function removeAccents(str) {
|
|
429
|
-
return str.replace(allAccents, match => {
|
|
430
|
-
return characterMap[match];
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* @name match-sorter
|
|
436
|
-
* @license MIT license.
|
|
437
|
-
* @copyright (c) 2099 Kent C. Dodds
|
|
438
|
-
* @author Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)
|
|
439
|
-
*/
|
|
440
|
-
const rankings = {
|
|
441
|
-
CASE_SENSITIVE_EQUAL: 7,
|
|
442
|
-
EQUAL: 6,
|
|
443
|
-
STARTS_WITH: 5,
|
|
444
|
-
WORD_STARTS_WITH: 4,
|
|
445
|
-
CONTAINS: 3,
|
|
446
|
-
ACRONYM: 2,
|
|
447
|
-
MATCHES: 1,
|
|
448
|
-
NO_MATCH: 0
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Gets the highest ranking for value for the given item based on its values for the given keys
|
|
453
|
-
* @param {*} item - the item to rank
|
|
454
|
-
* @param {Array} keys - the keys to get values from the item for the ranking
|
|
455
|
-
* @param {String} value - the value to rank against
|
|
456
|
-
* @param {Object} options - options to control the ranking
|
|
457
|
-
* @return {{rank: Number, accessorIndex: Number, accessorThreshold: Number}} - the highest ranking
|
|
458
|
-
*/
|
|
459
|
-
function rankItem(item, value, options) {
|
|
460
|
-
var _options$threshold;
|
|
461
|
-
|
|
462
|
-
options = options || {};
|
|
463
|
-
options.threshold = (_options$threshold = options.threshold) != null ? _options$threshold : rankings.MATCHES;
|
|
464
|
-
|
|
465
|
-
if (!options.accessors) {
|
|
466
|
-
// if keys is not specified, then we assume the item given is ready to be matched
|
|
467
|
-
const rank = getMatchRanking(item, value, options);
|
|
468
|
-
return {
|
|
469
|
-
// ends up being duplicate of 'item' in matches but consistent
|
|
470
|
-
rankedValue: item,
|
|
471
|
-
rank,
|
|
472
|
-
accessorIndex: -1,
|
|
473
|
-
accessorThreshold: options.threshold,
|
|
474
|
-
passed: rank >= options.threshold
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
const valuesToRank = getAllValuesToRank(item, options.accessors);
|
|
479
|
-
const rankingInfo = {
|
|
480
|
-
rankedValue: item,
|
|
481
|
-
rank: rankings.NO_MATCH,
|
|
482
|
-
accessorIndex: -1,
|
|
483
|
-
accessorThreshold: options.threshold,
|
|
484
|
-
passed: false
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
for (let i = 0; i < valuesToRank.length; i++) {
|
|
488
|
-
const rankValue = valuesToRank[i];
|
|
489
|
-
let newRank = getMatchRanking(rankValue.itemValue, value, options);
|
|
490
|
-
const {
|
|
491
|
-
minRanking,
|
|
492
|
-
maxRanking,
|
|
493
|
-
threshold
|
|
494
|
-
} = rankValue.attributes;
|
|
495
|
-
|
|
496
|
-
if (newRank < minRanking && newRank >= rankings.MATCHES) {
|
|
497
|
-
newRank = minRanking;
|
|
498
|
-
} else if (newRank > maxRanking) {
|
|
499
|
-
newRank = maxRanking;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
newRank = Math.min(newRank, maxRanking);
|
|
503
|
-
|
|
504
|
-
if (newRank > rankingInfo.rank) {
|
|
505
|
-
rankingInfo.rank = newRank;
|
|
506
|
-
rankingInfo.accessorIndex = i;
|
|
507
|
-
rankingInfo.accessorThreshold = threshold;
|
|
508
|
-
rankingInfo.rankedValue = rankValue.itemValue;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return rankingInfo;
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Gives a rankings score based on how well the two strings match.
|
|
516
|
-
* @param {String} testString - the string to test against
|
|
517
|
-
* @param {String} stringToRank - the string to rank
|
|
518
|
-
* @param {Object} options - options for the match (like keepDiacritics for comparison)
|
|
519
|
-
* @returns {Number} the ranking for how well stringToRank matches testString
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
function getMatchRanking(testString, stringToRank, options) {
|
|
523
|
-
testString = prepareValueForComparison(testString, options);
|
|
524
|
-
stringToRank = prepareValueForComparison(stringToRank, options); // too long
|
|
525
|
-
|
|
526
|
-
if (stringToRank.length > testString.length) {
|
|
527
|
-
return rankings.NO_MATCH;
|
|
528
|
-
} // case sensitive equals
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (testString === stringToRank) {
|
|
532
|
-
return rankings.CASE_SENSITIVE_EQUAL;
|
|
533
|
-
} // Lower casing before further comparison
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
testString = testString.toLowerCase();
|
|
537
|
-
stringToRank = stringToRank.toLowerCase(); // case insensitive equals
|
|
538
|
-
|
|
539
|
-
if (testString === stringToRank) {
|
|
540
|
-
return rankings.EQUAL;
|
|
541
|
-
} // starts with
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
if (testString.startsWith(stringToRank)) {
|
|
545
|
-
return rankings.STARTS_WITH;
|
|
546
|
-
} // word starts with
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if (testString.includes(" " + stringToRank)) {
|
|
550
|
-
return rankings.WORD_STARTS_WITH;
|
|
551
|
-
} // contains
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
if (testString.includes(stringToRank)) {
|
|
555
|
-
return rankings.CONTAINS;
|
|
556
|
-
} else if (stringToRank.length === 1) {
|
|
557
|
-
// If the only character in the given stringToRank
|
|
558
|
-
// isn't even contained in the testString, then
|
|
559
|
-
// it's definitely not a match.
|
|
560
|
-
return rankings.NO_MATCH;
|
|
561
|
-
} // acronym
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (getAcronym(testString).includes(stringToRank)) {
|
|
565
|
-
return rankings.ACRONYM;
|
|
566
|
-
} // will return a number between rankings.MATCHES and
|
|
567
|
-
// rankings.MATCHES + 1 depending on how close of a match it is.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
return getClosenessRanking(testString, stringToRank);
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Generates an acronym for a string.
|
|
574
|
-
*
|
|
575
|
-
* @param {String} string the string for which to produce the acronym
|
|
576
|
-
* @returns {String} the acronym
|
|
577
|
-
*/
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
function getAcronym(string) {
|
|
581
|
-
let acronym = '';
|
|
582
|
-
const wordsInString = string.split(' ');
|
|
583
|
-
wordsInString.forEach(wordInString => {
|
|
584
|
-
const splitByHyphenWords = wordInString.split('-');
|
|
585
|
-
splitByHyphenWords.forEach(splitByHyphenWord => {
|
|
586
|
-
acronym += splitByHyphenWord.substr(0, 1);
|
|
587
|
-
});
|
|
588
|
-
});
|
|
589
|
-
return acronym;
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Returns a score based on how spread apart the
|
|
593
|
-
* characters from the stringToRank are within the testString.
|
|
594
|
-
* A number close to rankings.MATCHES represents a loose match. A number close
|
|
595
|
-
* to rankings.MATCHES + 1 represents a tighter match.
|
|
596
|
-
* @param {String} testString - the string to test against
|
|
597
|
-
* @param {String} stringToRank - the string to rank
|
|
598
|
-
* @returns {Number} the number between rankings.MATCHES and
|
|
599
|
-
* rankings.MATCHES + 1 for how well stringToRank matches testString
|
|
600
|
-
*/
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
function getClosenessRanking(testString, stringToRank) {
|
|
604
|
-
let matchingInOrderCharCount = 0;
|
|
605
|
-
let charNumber = 0;
|
|
606
|
-
|
|
607
|
-
function findMatchingCharacter(matchChar, string, index) {
|
|
608
|
-
for (let j = index, J = string.length; j < J; j++) {
|
|
609
|
-
const stringChar = string[j];
|
|
610
|
-
|
|
611
|
-
if (stringChar === matchChar) {
|
|
612
|
-
matchingInOrderCharCount += 1;
|
|
613
|
-
return j + 1;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
return -1;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
function getRanking(spread) {
|
|
621
|
-
const spreadPercentage = 1 / spread;
|
|
622
|
-
const inOrderPercentage = matchingInOrderCharCount / stringToRank.length;
|
|
623
|
-
const ranking = rankings.MATCHES + inOrderPercentage * spreadPercentage;
|
|
624
|
-
return ranking;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
const firstIndex = findMatchingCharacter(stringToRank[0], testString, 0);
|
|
628
|
-
|
|
629
|
-
if (firstIndex < 0) {
|
|
630
|
-
return rankings.NO_MATCH;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
charNumber = firstIndex;
|
|
634
|
-
|
|
635
|
-
for (let i = 1, I = stringToRank.length; i < I; i++) {
|
|
636
|
-
const matchChar = stringToRank[i];
|
|
637
|
-
charNumber = findMatchingCharacter(matchChar, testString, charNumber);
|
|
638
|
-
const found = charNumber > -1;
|
|
639
|
-
|
|
640
|
-
if (!found) {
|
|
641
|
-
return rankings.NO_MATCH;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
const spread = charNumber - firstIndex;
|
|
646
|
-
return getRanking(spread);
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Sorts items that have a rank, index, and accessorIndex
|
|
650
|
-
* @param {Object} a - the first item to sort
|
|
651
|
-
* @param {Object} b - the second item to sort
|
|
652
|
-
* @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal
|
|
653
|
-
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
function compareItems(a, b) {
|
|
657
|
-
return a.rank === b.rank ? 0 : a.rank > b.rank ? -1 : 1;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Prepares value for comparison by stringifying it, removing diacritics (if specified)
|
|
661
|
-
* @param {String} value - the value to clean
|
|
662
|
-
* @param {Object} options - {keepDiacritics: whether to remove diacritics}
|
|
663
|
-
* @return {String} the prepared value
|
|
664
|
-
*/
|
|
665
|
-
|
|
666
|
-
function prepareValueForComparison(value, _ref) {
|
|
667
|
-
let {
|
|
668
|
-
keepDiacritics
|
|
669
|
-
} = _ref;
|
|
670
|
-
// value might not actually be a string at this point (we don't get to choose)
|
|
671
|
-
// so part of preparing the value for comparison is ensure that it is a string
|
|
672
|
-
value = "" + value; // toString
|
|
673
|
-
|
|
674
|
-
if (!keepDiacritics) {
|
|
675
|
-
value = removeAccents(value);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
return value;
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Gets value for key in item at arbitrarily nested keypath
|
|
682
|
-
* @param {Object} item - the item
|
|
683
|
-
* @param {Object|Function} key - the potentially nested keypath or property callback
|
|
684
|
-
* @return {Array} - an array containing the value(s) at the nested keypath
|
|
685
|
-
*/
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
function getItemValues(item, accessor) {
|
|
689
|
-
let accessorFn = accessor;
|
|
690
|
-
|
|
691
|
-
if (typeof accessor === 'object') {
|
|
692
|
-
accessorFn = accessor.accessor;
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
const value = accessorFn(item); // because `value` can also be undefined
|
|
696
|
-
|
|
697
|
-
if (value == null) {
|
|
698
|
-
return [];
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
if (Array.isArray(value)) {
|
|
702
|
-
return value;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
return [String(value)];
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* Gets all the values for the given keys in the given item and returns an array of those values
|
|
709
|
-
* @param item - the item from which the values will be retrieved
|
|
710
|
-
* @param keys - the keys to use to retrieve the values
|
|
711
|
-
* @return objects with {itemValue, attributes}
|
|
712
|
-
*/
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
function getAllValuesToRank(item, accessors) {
|
|
716
|
-
const allValues = [];
|
|
717
|
-
|
|
718
|
-
for (let j = 0, J = accessors.length; j < J; j++) {
|
|
719
|
-
const accessor = accessors[j];
|
|
720
|
-
const attributes = getAccessorAttributes(accessor);
|
|
721
|
-
const itemValues = getItemValues(item, accessor);
|
|
722
|
-
|
|
723
|
-
for (let i = 0, I = itemValues.length; i < I; i++) {
|
|
724
|
-
allValues.push({
|
|
725
|
-
itemValue: itemValues[i],
|
|
726
|
-
attributes
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
return allValues;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
const defaultKeyAttributes = {
|
|
735
|
-
maxRanking: Infinity,
|
|
736
|
-
minRanking: -Infinity
|
|
737
|
-
};
|
|
738
|
-
/**
|
|
739
|
-
* Gets all the attributes for the given accessor
|
|
740
|
-
* @param accessor - the accessor from which the attributes will be retrieved
|
|
741
|
-
* @return object containing the accessor's attributes
|
|
742
|
-
*/
|
|
743
|
-
|
|
744
|
-
function getAccessorAttributes(accessor) {
|
|
745
|
-
if (typeof accessor === 'function') {
|
|
746
|
-
return defaultKeyAttributes;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
return { ...defaultKeyAttributes,
|
|
750
|
-
...accessor
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
exports.compareItems = compareItems;
|
|
755
|
-
exports.rankItem = rankItem;
|
|
756
|
-
exports.rankings = rankings;
|
|
757
|
-
//# sourceMappingURL=index.js.map
|