Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle process.version set to undefined #78

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ export function getUserAgent() {
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
})`;
}

if (typeof EdgeRuntime === "string") {
return "Edge Runtime";
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel too comfortable to start adding vendor-specific code. Could you for now leave that out and we discuss it in an issue? Maybe we can find another way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, removed


return "<environment undetectable>";
}