# Parser

The main class that arranges the whole parsing process.

## Constructor

#### new Parser(UA, skipParsingopt)

Source:
  - parser.js, line 23

Create instance of Parser

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`UA` | String |  |  | User-Agent string
`skipParsing` | Boolean | <optional> | `false` | parser can skip parsing in purpose of performance improvements if you need to make a more particular parsing like Parser#parseBrowser or Parser#parsePlatform

### Methods

#### getBrowser() → {Object}

Source:
  - parser.js, line 110

Get parsed browser object

##### Returns:

Type
  Object

#### getBrowserName() → {String}

Source:
  - parser.js, line 124

Get browser's name

##### Returns:

Browser's name or an empty string

Type
  String

#### getBrowserVersion() → {String}

Source:
  - parser.js, line 138

Get browser's version

##### Returns:

version of browser

Type
  String

#### getEngine() → {Object}

Source:
  - parser.js, line 267

Get parsed engine

##### Returns:

Type
  Object

#### getEngineName() → {String}

Source:
  - parser.js, line 281

Get engines's name

##### Returns:

Engines's name or an empty string

Type
  String

#### getOS() → {Object}

Source:
  - parser.js, line 153

Get OS

##### Example

    this.getOS();
    {
      name: 'macOS',
      version: '10.11.12'
    }

##### Returns:

Type
  Object

#### getOSName(toLowerCaseopt) → {String}

Source:
  - parser.js, line 192

Get OS name

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`toLowerCase` | Boolean | <optional> | return lower-cased value

##### Returns:

name of the OS — macOS, Windows, Linux, etc.

Type
  String

#### getOSVersion() → {String}

Source:
  - parser.js, line 206

Get OS version

##### Returns:

full version with dots ('10.11.12', '5.6', etc)

Type
  String

#### getPlatform() → {Object}

Source:
  - parser.js, line 214

Get parsed platform

##### Returns:

Type
  Object

#### getPlatformType(toLowerCaseopt) → {*}

Source:
  - parser.js, line 227

Get platform name

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`toLowerCase` | Boolean | <optional> | `false` |

##### Returns:

Type
  *

#### getResult() → {ParsedResult}

Source:
  - parser.js, line 331

Get parsed result

##### Returns:

Type
  ParsedResult

#### getUA() → {String}

Source:
  - parser.js, line 65

Get UserAgent string of current Parser instance

##### Returns:

User-Agent String of the current <Parser> object

Type
  String

#### is(anything, includingAliasopt) → {Boolean}

Source:
  - parser.js, line 481

Is anything? Check if the browser is called "anything", the OS called "anything" or the platform called "anything"

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`anything` | String |  |  |
`includingAlias` |  | <optional> | `false` | The flag showing whether alias will be included into comparison

##### Returns:

Type
  Boolean

#### isBrowser(browserName, includingAliasopt) → {boolean}

Source:
  - parser.js, line 415

Check if the browser name equals the passed string

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`browserName` |  |  |  | The string to compare with the browser name
`includingAlias` |  | <optional> | `false` | The flag showing whether alias will be included into comparison

##### Returns:

Type
  boolean

#### parse() → {Parser}

Source:
  - parser.js, line 318

Parse full information about the browser

##### Returns:

Type
  Parser

#### parseBrowser() → {Object}

Source:
  - parser.js, line 82

Get parsed browser object

##### Returns:

Type
  Object

#### parseEngine() → {Object}

Source:
  - parser.js, line 292

Get parsed platform

##### Returns:

Type
  Object

#### parseOS() → {*|Object}

Source:
  - parser.js, line 165

Parse OS and save it to this.parsedResult.os

##### Returns:

Type
  * | Object

#### parsePlatform() → {Object}

Source:
  - parser.js, line 241

Get parsed platform

##### Returns:

Type
  Object

#### satisfies(checkTree) → {Boolean|undefined}

Source:
  - parser.js, line 353

Check if parsed browser matches certain conditions

##### Example

    const browser = Bowser.getParser(window.navigator.userAgent);
    if (browser.satisfies({chrome: '>118.01.1322' }))
    // or with os
    if (browser.satisfies({windows: { chrome: '>118.01.1322' } }))
    // or with platforms
    if (browser.satisfies({desktop: { chrome: '>118.01.1322' } }))

##### Parameters:

Name | Type | Description
--- | --- | ---
`checkTree` | Object | It's one or two layered object, which can include a platform or an OS on the first layer and should have browsers specs on the bottom-laying layer

##### Returns:

Whether the browser satisfies the set conditions or not. Returns `undefined` when the browser is no described in the checkTree object.

Type
  Boolean | undefined

#### some(anythings) → {Boolean}

Source:
  - parser.js, line 491

Check if any of the given values satisfies this.is(anything)

##### Parameters:

Name | Type | Description
--- | --- | ---
`anythings` | Array.<String> |

##### Returns:

Type
  Boolean

#### test(regex) → {Boolean}

Source:
  - parser.js, line 74

Test a UA string for a regexp

##### Parameters:

Name | Type | Description
--- | --- | ---
`regex` | RegExp |

##### Returns:

Type
  Boolean