github
451 of 482 branches covered (93.57%)
Branch coverage included in aggregate %.
30 of 30 new or added lines in 2 files covered. (100.0%)
4516 of 4538 relevant lines covered (99.52%)
269.16 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 "uknown-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✔ |