github
451 of 482 branches covered (93.57%)
Branch coverage included in aggregate %.
32 of 32 new or added lines in 2 files covered. (100.0%)
4516 of 4540 relevant lines covered (99.47%)
269.04 hits per line
|
import bowser from "bowser";
|
1✔ |
|
import { isBrowser, isNode } from "browser-or-node";
|
1✔ |
|
|
1✔ |
|
const CLIENT_NAME = "univapay-node"; |
1✔ |
|
|
1✔ |
|
function getPlatform() { |
|
|
if (isNode) {
|
2,565✔ |
|
return `node.js@${process.versions.node}`; |
2,565✔ |
|
} |
2,565✔ |
|
|
|
|
if (isBrowser) {
|
× |
|
const {
|
× |
|
browser: { name, version },
|
× |
|
} = bowser.parse(window.navigator.userAgent); |
× |
|
|
× |
|
return `${name}@${version}`; |
× |
|
} |
× |
|
|
× |
|
return "unknown-platform"; |
× |
|
} |
× |
|
|
1✔ |
|
function getModuleType() { |
|
|
return typeof require === "function" ? "commonjs" : "module"; |
|
|
} |
2,565✔ |
|
|
1✔ |
|
export function userAgent() {
|
|
|
return `${CLIENT_NAME} ${getPlatform()} ${getModuleType()}`; |
2,565✔ |
|
} |
2,565✔ |