Skip to content

Commit

Permalink
fix: handle process.version set to undefined (#78) (#80)
Browse files Browse the repository at this point in the history
Vercel's [Edge Runtime](https://edge-runtime.vercel.app/) is not Node.js, but will have a global `process` defined

Co-authored-by: Jascha Ephraim <jaschaephraim@gmail.com>
  • Loading branch information
gr2m and jaschaephraim committed Nov 4, 2023
1 parent a52f688 commit 8619fad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function getUserAgent(): string {
return navigator.userAgent;
}

if (typeof process === "object" && "version" in process) {
if (typeof process === "object" && process.version !== undefined) {
return `Node.js/${process.version.substr(1)} (${process.platform}; ${
process.arch
})`;
Expand Down

0 comments on commit 8619fad

Please sign in to comment.