Can anyone just point me in the right direction for coming up with a better solution for parsing the ‘user=agent’?
I was able to parse the address and the language in three lines each using libraries but could not find a similar solution for ‘user-agent’ so I had to hack something together. It works for now but doesn’t look like a good solution:
var source = req.headers['user-agent'];
var strungSource = JSON.stringify(source)
var strungSourceArr = strungSource.split(" ");
var newString = strungSourceArr[1]+" "+strungSourceArr[2]+" "+strungSourceArr[3]+" "+strungSourceArr[4];
var updatedString = newString.substring(1, newString.length-1);
console.log(updatedString)