Fallback to displaying full user-agent string if a pretty version cannot be determined

This commit is contained in:
Gabe Kangas 2021-07-22 15:18:38 -07:00
parent 3e5f99cf19
commit ca050d7990

View file

@ -55,6 +55,12 @@ export function formatUAstring(uaString: string) {
const { major: browserVersion, name } = browser;
const { version: osVersion, name: osName } = os;
const { model, type } = device;
// Fallback to just displaying the raw agent string.
if (!name || !browserVersion || !osName) {
return uaString;
}
const deviceString = model || type ? ` (${model || type})` : '';
return `${name} ${browserVersion} on ${osName} ${osVersion}
${deviceString}`;