mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-10-01 17:57:44 +03:00
Fix #300 : Provide enums - initial work
This commit is contained in:
@@ -477,6 +477,14 @@ console.log('Server running at http://127.0.0.1:1337/');
|
||||
|
||||
```js
|
||||
import { UAParser } from 'ua-parser-js';
|
||||
import { CPUArch, DeviceType } from 'ua-parser-js/enums';
|
||||
|
||||
const { cpu, device } = UAParser('Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090928 Firefox/3.5 Maemo Browser 1.4.1.22 RX-51 N900');
|
||||
|
||||
console.log(browser.name) // Maemo Browser
|
||||
console.log(cpu.is(CPUArch.ARM)) // true
|
||||
console.log(device.is(DeviceType.MOBILE)) // true
|
||||
console.log(device.model) // N900
|
||||
```
|
||||
|
||||
## Using TypeScript
|
||||
|
Reference in New Issue
Block a user