-
Notifications
You must be signed in to change notification settings - Fork 497
Conversation
…tions on the main export for parsing only the UA, OS and device.
console.log(r.os.patch); // -> null | ||
|
||
console.log(r.os.tostring()); // -> "iOS 5.1" | ||
console.log(r.os.toVersionString()); // -> "5.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section appears to be a duplicate of the previous.
Would be nice to get this merged, I'm in need of a replacement for a certain jQuery plugin I used to use for userAgent detection would like to use ua-parser instead. But that depends on #66, which I won't rebase until you're ready with this (unless you are willing to merge mine first and rebase this, but since they are overlapping and implementing similar things in different ways, I assume not). |
@bluesmoon I'd like your advise on this. Adding parsing for the device and os as part of the same function adds a significant cost to this, and you were already worrying about perf implication earlier on. Is adding a function that does only UA parsing a good enough option in your book? |
// -> 1 | ||
var r = uaParser.parse(navigator.userAgent); | ||
|
||
console.log(r.ua.tostring()); // -> "Safari 5.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Properties (including functions) are case sensitive. This should be toString
(same for r.os.tostring
).
Yes, as long as the caller can choose whether to call |
JS refactoring
Fix broken indentation in test file
This adds a bunch of tests and does a full re-write.
To run tests install mocha, then: