@ -12,12 +12,23 @@ If it's a small hot-fix, an improvement to the docs, or added support for a new
Following these simple rules will really help maintain the repo! Thanks ❤️
Following these simple rules will really help maintain the repo! Thanks ❤️
## Adding Tests
## Adding Browser Support and Tests
See the list in `test/acceptance/useragentstrings.yml` with example user agents and their expected `bowser` object.
See the list in `test/acceptance/useragentstrings.yml` with example user agents and their expected `bowser` object.
Whenever you add support for new browsers or notice a bug / mismatch, please update the list and
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`.
check if all tests are still passing.
For creating aliases, keep the following guidelines in mind:
- 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
- always check for possible duplicates
- aliases are supposed to also be a shorter version of the original name
@ -572,7 +572,7 @@ const result = parser.getResult();</code></pre>
<brclass="clear">
<brclass="clear">
<footer>
<footer>
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
@ -2793,7 +2793,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<brclass="clear">
<brclass="clear">
<footer>
<footer>
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
@ -1839,7 +1995,7 @@ like <code>"iPhone"</code> or <code>"Kindle Fire HD 7"</code
<brclass="clear">
<brclass="clear">
<footer>
<footer>
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
});</code></pre><p>Settings for any particular OS or platform has more priority and redefines settings of standalone browsers.
});</code></pre><p>Settings for any particular OS or platform has more priority and redefines settings of standalone browsers.
Thus, you can define OS or platform specific rules and they will have more priority in the end.</p>
Thus, you can define OS or platform specific rules and they will have more priority in the end.</p>
<p>More of API and possibilities you will find in the <code>docs</code> folder.</p>
<p>More of API and possibilities you will find in the <code>docs</code> folder.</p>
<h3>Similar Projects</h3><ul>
<h3>Browser names for <code>.satisfies()</code></h3><p>By default you are supposed to use the full browser name for <code>.satisfies</code>.
But, there's a short way to define a browser using short aliases. The full
list of aliases can be found in <ahref="src/constants.js">the file</a>.</p>
<h2>Similar Projects</h2><ul>
<li><ahref="https://github.com/BigBadBleuCheese/Kong">Kong</a> - A C# port of Bowser.</li>
<li><ahref="https://github.com/BigBadBleuCheese/Kong">Kong</a> - A C# port of Bowser.</li>
</ul>
</ul>
<h3>License</h3><p>Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.</p></article>
<h2>License</h2><p>Licensed as MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.</p></article>
</section>
</section>
@ -154,7 +157,7 @@ Thus, you can define OS or platform specific rules and they will have more prior
<brclass="clear">
<brclass="clear">
<footer>
<footer>
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
<preclass="prettyprint source linenums"><code>export default class Utils {
<preclass="prettyprint source linenums"><code>import { BROWSER_ALIASES_MAP } from './constants.js';
export default class Utils {
/**
/**
* Get first matched item for a string
* Get first matched item for a string
* @param {RegExp} regexp
* @param {RegExp} regexp
@ -230,6 +232,19 @@
}
}
return result;
return result;
}
}
/**
* Get short version/alias for a browser name
*
* @example
* getBrowserAlias('Microsoft Edge') // edge
*
* @param {string} browserName
* @return {string}
*/
static getBrowserAlias(browserName) {
return BROWSER_ALIASES_MAP[browserName];
}
}
}
</code></pre>
</code></pre>
</article>
</article>
@ -245,7 +260,7 @@
<brclass="clear">
<brclass="clear">
<footer>
<footer>
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Wed Mar 06 2019 14:31:23 GMT+0200 (EET) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <ahref="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Apr 07 2019 11:48:14 GMT+0300 (EEST) using the <ahref="https://github.com/clenemt/docdash">docdash</a> theme.
ua:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 YaBrowser/19.3.3.157.10 Mobile/15E148 Safari/605.1"
spec:
browser:
name:"Yandex Browser"
version:"19.3.3.157.10"
os:
name:"iOS"
version:"12.2"
platform:
type:"mobile"
vendor:"Apple"
model:"iPhone"
engine:
name:"WebKit"
version:"605.1.15"
Safari:
Safari:
-
-
ua:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"
ua:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"