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

Add constant output so that users can quickly get all types

This commit is contained in:
王涛
2019-05-20 15:33:10 +08:00
parent f567ab3ec2
commit fbc32e6736
8 changed files with 146 additions and 52 deletions

View File

@@ -409,15 +409,14 @@ class Parser {
* @returns {boolean}
*/
isBrowser(browserName, includingAlias = false) {
const defaultBrowserName = this.getBrowserName();
const possibleNames = [defaultBrowserName.toLowerCase()];
const alias = Utils.getBrowserAlias(defaultBrowserName);
const defaultBrowserName = this.getBrowserName().toLowerCase();
let browserNameLower = browserName.toLowerCase();
const alias = Utils.getBrowserTypeByAlias(browserNameLower);
if (includingAlias && typeof alias !== 'undefined') {
possibleNames.push(alias.toLowerCase());
if (includingAlias && alias) {
browserNameLower = alias.toLowerCase();
}
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
return browserNameLower === defaultBrowserName;
}
compareVersion(version) {