mirror of
https://github.com/lancedikson/bowser
synced 2026-03-02 03:40:27 +00:00
Add OS parsing
This commit is contained in:
24
src/parser-os.js
Normal file
24
src/parser-os.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { getFirstMatch } from './utils';
|
||||
|
||||
export default [
|
||||
{
|
||||
test: [/windows phone/i],
|
||||
detect(ua) {
|
||||
const version = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i, ua);
|
||||
return {
|
||||
name: 'Windows Phone',
|
||||
version
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: [/macintosh/i],
|
||||
detect(ua) {
|
||||
const version = getFirstMatch(/mac os x (\d+([_\s]\d+)*)/i, ua).replace(/[_\s]/g, '.');
|
||||
return {
|
||||
name: 'macOS',
|
||||
version
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user