MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / getBrowserInfo

Function getBrowserInfo

out/cli.cjs:69987–70009  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69985 "X-Stainless-Lang": "js",
69986 "X-Stainless-Package-Version": VERSION,
69987 "X-Stainless-OS": "Unknown",
69988 "X-Stainless-Arch": "unknown",
69989 "X-Stainless-Runtime": "unknown",
69990 "X-Stainless-Runtime-Version": "unknown"
69991 };
69992};
69993function getBrowserInfo() {
69994 if (typeof navigator === "undefined" || !navigator) {
69995 return null;
69996 }
69997 const browserPatterns = [
69998 { key: "edge", pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
69999 { key: "ie", pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
70000 { key: "ie", pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ },
70001 { key: "chrome", pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
70002 { key: "firefox", pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ },
70003 { key: "safari", pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ }
70004 ];
70005 for (const { key, pattern } of browserPatterns) {
70006 const match = pattern.exec(navigator.userAgent);
70007 if (match) {
70008 const major = match[1] || 0;
70009 const minor = match[2] || 0;
70010 const patch = match[3] || 0;
70011 return { browser: key, version: `${major}.${minor}.${patch}` };
70012 }

Callers 1

getPlatformPropertiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected