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

Function testUserAgent

packages/react-aria/src/utils/platform.ts:13–23  ·  view source on GitHub ↗
(re: RegExp)

Source from the content-addressed store, hash-verified

11 */
12
13function testUserAgent(re: RegExp) {
14 if (typeof window === 'undefined' || window.navigator == null) {
15 return false;
16 }
17 let brands = window.navigator['userAgentData']?.brands;
18 return (
19 (Array.isArray(brands) &&
20 brands.some((brand: {brand: string; version: string}) => re.test(brand.brand))) ||
21 re.test(window.navigator.userAgent)
22 );
23}
24
25function testPlatform(re: RegExp) {
26 return typeof window !== 'undefined' && window.navigator != null

Callers 1

platform.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected