Fix #300 : Provide enums - initial work

This commit is contained in:
Faisal Salman
2023-03-28 06:23:19 +07:00
parent ba28d33d51
commit af65fd6960
5 changed files with 230 additions and 3 deletions

View File

@@ -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