Skip to content

Commit

Permalink
fix: use same code for all environments
Browse files Browse the repository at this point in the history
BREAKING CHANGE: no longer uses `os-name` in Node environment. The platform release version is no longer included. For example `"Node.js/10.21.0 (Linux 4.15; x64)"` is now `"Node.js/10.21.0 (Linux; x64)"
  • Loading branch information
gr2m committed Jul 16, 2020
1 parent f1ff8bd commit 00641ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 23 deletions.
7 changes: 0 additions & 7 deletions src/browser.ts

This file was deleted.

14 changes: 13 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export { getUserAgent } from "./node";
export function getUserAgent(): string {
if (typeof navigator === "object" && "userAgent" in navigator) {
return navigator.userAgent;
}

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

return "<environment undetectable>";
}
15 changes: 0 additions & 15 deletions src/node.ts

This file was deleted.

0 comments on commit 00641ee

Please sign in to comment.