mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Update rules for creating browser aliases
This commit is contained in:
parent
064aa812fc
commit
b111862cce
@ -19,17 +19,16 @@ See the list in `test/acceptance/useragentstrings.yml` with example user agents
|
||||
Whenever you add support for new browsers or notice a bug / mismatch, please update the list and check if all tests are still passing. Also, make sure to keep the list of browser aliases up-to-date in `src/constants.js`.
|
||||
|
||||
For creating aliases, keep the following guidelines in mind:
|
||||
- use snake_case style for names
|
||||
- use only lowercase letters for names
|
||||
- replace special characters such as space and dashes by underscore
|
||||
- whenever possible drop the word `browser` from the original browser name
|
||||
- replace dashes with underscore
|
||||
- avoid capital letters
|
||||
- always check for possible duplicates
|
||||
- aliases are supposed to also be a shorter version of the original name
|
||||
|
||||
Examples:
|
||||
`Opera Coast` --> `opera_coast`
|
||||
`UC Browser` --> `uc`
|
||||
`SeaMonkey` --> `sea_monkey`
|
||||
`SeaMonkey` --> `seamonkey`
|
||||
|
||||
## Testing
|
||||
|
||||
|
@ -4,7 +4,7 @@ const BROWSER_ALIASES_MAP = {
|
||||
'Amazon Silk': 'amazon_silk',
|
||||
'Android Browser': 'android',
|
||||
Bada: 'bada',
|
||||
BlackBerry: 'black_berry',
|
||||
BlackBerry: 'blackberry',
|
||||
Chrome: 'chrome',
|
||||
Chromium: 'chromium',
|
||||
Epiphany: 'epiphany',
|
||||
@ -20,19 +20,19 @@ const BROWSER_ALIASES_MAP = {
|
||||
'NAVER Whale Browser': 'naver',
|
||||
Opera: 'opera',
|
||||
'Opera Coast': 'opera_coast',
|
||||
PhantomJS: 'phantom_js',
|
||||
PhantomJS: 'phantomjs',
|
||||
Puffin: 'puffin',
|
||||
QupZilla: 'qup_zilla',
|
||||
QupZilla: 'qupzilla',
|
||||
Safari: 'safari',
|
||||
Sailfish: 'sailfish',
|
||||
SeaMonkey: 'sea_monkey',
|
||||
SeaMonkey: 'seamonkey',
|
||||
Sleipnir: 'sleipnir',
|
||||
Swing: 'swing',
|
||||
Tizen: 'tizen',
|
||||
'UC Browser': 'uc',
|
||||
Vivaldi: 'vivaldi',
|
||||
'WebOS Browser': 'web_os',
|
||||
WeChat: 'we_chat',
|
||||
'WebOS Browser': 'webos',
|
||||
WeChat: 'wechat',
|
||||
'Yandex Browser': 'yandex'
|
||||
};
|
||||
|
||||
|
@ -407,7 +407,7 @@ class Parser {
|
||||
const possibleNames = [defaultBrowserName.toLowerCase()];
|
||||
|
||||
if (loosely) {
|
||||
possibleNames.push(getBrowserAlias(defaultBrowserName).toLowerCase());
|
||||
possibleNames.push(Utils.getBrowserAlias(defaultBrowserName).toLowerCase());
|
||||
}
|
||||
|
||||
return possibleNames.indexOf(browserName.toLowerCase()) !== -1;
|
||||
|
Loading…
Reference in New Issue
Block a user