1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

Merge pull request #288 from ffaubert/add-engine-api

Add getEngineName and isEngine API calls
This commit is contained in:
Denis Demchenko
2019-01-24 22:44:29 +02:00
committed by GitHub
2 changed files with 32 additions and 0 deletions

View File

@@ -272,6 +272,19 @@ class Parser {
return this.parseEngine();
}
/**
* Get engines's name
* @return {String} Engines's name or an empty string
*
* @public
*/
getEngineName(toLowerCase) {
if (toLowerCase) {
return String(this.getEngine().name).toLowerCase() || '';
}
return this.getEngine().name || '';
}
/**
* Get parsed platform
* @return {{}}
@@ -437,6 +450,10 @@ class Parser {
return this.getPlatformType(true) === String(platformType).toLowerCase();
}
isEngine(engineName) {
return this.getEngineName(true) === String(engineName).toLowerCase();
}
/**
* Is anything? Check if the browser is called "anything",
* the OS called "anything" or the platform called "anything"