Skip to content

Commit 98475d3

Browse files
authored
fix: s.brands.find is not a function error fix (#362)
1 parent c9cfc2a commit 98475d3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Device.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,10 @@ function getChromiumMajorVersion(
706706
// Some nasty browser extensions define their own custom
707707
// navigator.userAgentData without mandatory `brands` field, so let's be
708708
// ready for it.
709-
const chromiumBrand = (userAgentData.brands ?? []).find(
709+
const brands = Array.isArray(userAgentData.brands)
710+
? userAgentData.brands
711+
: [];
712+
const chromiumBrand = brands.find(
710713
b => b.brand === 'Chromium'
711714
);
712715

0 commit comments

Comments
 (0)