Global

Methods

getAndroidVersionName(version) → {string}

Source:

Get Android version name 1.5 - Cupcake 1.6 - Donut 2.0 - Eclair 2.1 - Eclair 2.2 - Froyo 2.x - Gingerbread 3.x - Honeycomb 4.0 - Ice Cream Sandwich 4.1 - Jelly Bean 4.4 - KitKat 5.x - Lollipop 6.x - Marshmallow 7.x - Nougat 8.x - Oreo 9.x - Pie

Example
getAndroidVersionName("7.0") // 'Nougat'
Parameters:
Name Type Description
version string
Returns:

versionName

Type
string

getBrowserAlias(browserName) → {string}

Source:

Get short version/alias for a browser name

Example
getBrowserAlias('Microsoft Edge') // edge
Parameters:
Name Type Description
browserName string
Returns:
Type
string

getBrowserTypeByAlias(browserName) → {string}

Source:

Get short version/alias for a browser name

Example
getBrowserAlias('edge') // Microsoft Edge
Parameters:
Name Type Description
browserName string
Returns:
Type
string

getFirstMatch(regexp, ua) → {Array|Object|*|boolean|string}

Source:

Get first matched item for a string

Parameters:
Name Type Description
regexp RegExp
ua String
Returns:
Type
Array | Object | * | boolean | string

getMacOSVersionName(version) → {string}

Source:

Get macOS version name 10.5 - Leopard 10.6 - Snow Leopard 10.7 - Lion 10.8 - Mountain Lion 10.9 - Mavericks 10.10 - Yosemite 10.11 - El Capitan 10.12 - Sierra 10.13 - High Sierra 10.14 - Mojave 10.15 - Catalina

Example
getMacOSVersionName("10.14") // 'Mojave'
Parameters:
Name Type Description
version string
Returns:

versionName

Type
string

getSecondMatch(regexp, ua) → {Array|Object|*|boolean|string}

Source:

Get second matched item for a string

Parameters:
Name Type Description
regexp
ua String
Returns:
Type
Array | Object | * | boolean | string

getVersionPrecision(version) → {number}

Source:

Get version precisions count

Example
getVersionPrecision("1.10.3") // 3
Parameters:
Name Type Description
version string
Returns:
Type
number

map(arr, iterator) → {Array}

Source:

Array::map polyfill

Parameters:
Name Type Description
arr Array
iterator function
Returns:
Type
Array

matchAndReturnConst(regexp, ua, _const) → {*}

Source:

Match a regexp and return a constant or undefined

Parameters:
Name Type Description
regexp RegExp
ua String
_const *

Any const that will be returned if regexp matches the string

Returns:
Type
*

Type Definitions

ParsedResult

Source:
Properties:
Name Type Description
browser Object
Properties
Name Type Attributes Description
name String | undefined <optional>

Browser name, like "Chrome" or "Internet Explorer"

version String | undefined <optional>

Browser version as a String "12.01.45334.10"

os Object
Properties
Name Type Attributes Description
name String | undefined <optional>

OS name, like "Windows" or "macOS"

version String | undefined <optional>

OS version, like "NT 5.1" or "10.11.1"

versionName String | undefined <optional>

OS name, like "XP" or "High Sierra"

platform Object
Properties
Name Type Attributes Description
type String | undefined <optional>

platform type, can be either "desktop", "tablet" or "mobile"

vendor String | undefined <optional>

Vendor of the device, like "Apple" or "Samsung"

model String | undefined <optional>

Device model, like "iPhone" or "Kindle Fire HD 7"

engine Object
Properties
Name Type Attributes Description
name String | undefined <optional>

Can be any of this: WebKit, Blink, Gecko, Trident, Presto, EdgeHTML

version String | undefined <optional>

String version of the engine