MCPcopy Index your code
hub / github.com/adobe/react-spectrum / useCollator

Function useCollator

packages/react-aria/src/i18n/useCollator.ts:23–40  ·  view source on GitHub ↗
(options?: Intl.CollatorOptions)

Source from the content-addressed store, hash-verified

21 * @param options - Collator options.
22 */
23export function useCollator(options?: Intl.CollatorOptions): Intl.Collator {
24 let {locale} = useLocale();
25
26 let cacheKey =
27 locale +
28 (options
29 ? Object.entries(options)
30 .sort((a, b) => (a[0] < b[0] ? -1 : 1))
31 .join()
32 : '');
33 if (cache.has(cacheKey)) {
34 return cache.get(cacheKey)!;
35 }
36
37 let formatter = new Intl.Collator(locale, options);
38 cache.set(cacheKey, formatter);
39 return formatter;
40}

Callers 15

useFilterFunction · 0.90
useSelectableListFunction · 0.90
useGridFunction · 0.90
useTableFunction · 0.90
useSelectFunction · 0.90
ListBoxInnerFunction · 0.90
GridListInnerFunction · 0.90
TreeInnerFunction · 0.90
AppFunction · 0.90
ExampleAppFunction · 0.90
CardView.test.jsFile · 0.90
CardView.tsxFile · 0.90

Calls 4

useLocaleFunction · 0.90
sortMethod · 0.65
hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected