Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
parse user agent string to human readable object like os, device, browser, etc
A parser for user agent to simple js object
npm i ua-spy -S
const { detectAll } = require('ua-spy')
const parse = detectAll()
const all = parse('Mozilla/5.0 (Linux; Android 5.1.1; vivo X6S A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044207 Mobile Safari/537.36 MicroMessenger/6.7.3.1340(0x26070332) NetType/4G Language/zh_CN Process/tools')
console.log('result is', all)
/*
{
"os": {
"name": "Android",
"version": "5.1.1"
},
"app": {
"name": "na",
"version": "-"
},
"browser": {
"name": "Chrome",
"version": "57"
},
"device": {
"name": "vivo",
"version": "X6S"
},
"sdk": {
"name": "na",
"version": "-"
}
}
*/
const patchParser = detectAll({
osPatches: [
['MYOS', /\bMYOS ([\d.]+)/],
],
appPatches: [
['TAOBAO', /\bTB\/([\d.]+)/]
],
browserPatches: [
['UC', /\bMYUC ([\d._]+)/]
],
devicePatches: [
['YEJIDEVICE', /\bYEJIDEVICE ?([\d.]+)/]
],
sdkPatches: [
// The first match is name, the second is version
['any', /\bTestName\(([\w_-]+)\/([\d.]+)/],
],
})
const MY_UA = 'MYOS 3.3.3 Mozilla/5.0 YEJIDEVICE 1.1.1 (iPhone; CPU iPhone OS 11_4 like Mac OS X) TB/1.1.1 MYUC 2.0 AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79 TestName(tname_1-1/99.9)'
console.log('result is', patchParser(MY_UA))
/*
{
"os": {
"name": "MYOS",
"version": "3.3.3"
},
"app": {
"name": "TAOBAO",
"version": "1.1.1"
},
"browser": {
"name": "UC",
"version": "2.0"
},
"device": {
"name": "YEJIDEVICE",
"version": "1.1.1"
},
"sdk": {
"name": "tname_1-1",
"version": "99.9"
}
}
*/
MIT
FAQs
parse user agent string to human readable object like os, device, browser, etc
The npm package ua-spy receives a total of 597 weekly downloads. As such, ua-spy popularity was classified as not popular.
We found that ua-spy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.