1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Fix the bug with unset alias for a browser

fix #313
This commit is contained in:
Denis Demchenko 2019-04-12 21:04:58 +03:00
parent 1d66cb9e89
commit 69972820c8

View File

@ -402,12 +402,13 @@ class Parser {
return undefined; return undefined;
} }
isBrowser(browserName, loosely = false) { isBrowser(browserName, includingAlias = false) {
const defaultBrowserName = this.getBrowserName(); const defaultBrowserName = this.getBrowserName();
const possibleNames = [defaultBrowserName.toLowerCase()]; const possibleNames = [defaultBrowserName.toLowerCase()];
const alias = Utils.getBrowserAlias(defaultBrowserName);
if (loosely) { if (includingAlias && typeof alias !== 'undefined') {
possibleNames.push(Utils.getBrowserAlias(defaultBrowserName).toLowerCase()); possibleNames.push(alias.toLowerCase());
} }
return possibleNames.indexOf(browserName.toLowerCase()) !== -1; return possibleNames.indexOf(browserName.toLowerCase()) !== -1;