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

make public getBrowser and private parseBrowser

This commit is contained in:
Denis Demchenko 2017-04-09 19:16:38 +03:00
parent 3bb6654320
commit 9e46db26ed

View File

@ -30,13 +30,9 @@ class Parser {
* Get parsed browser object * Get parsed browser object
* @return {Object} * @return {Object}
* *
* @public * @private
*/ */
parseBrowser() { _parseBrowser() {
if (this.parsedResult.browser) {
return this.parsedResult.browser;
}
this.parsedResult.browser = {}; this.parsedResult.browser = {};
const browser = browsersList.find((browser) => { const browser = browsersList.find((browser) => {
@ -50,6 +46,20 @@ class Parser {
return this.parsedResult.browser; return this.parsedResult.browser;
} }
/**
* Get parsed browser object
* @return {Object}
*
* @public
*/
getBrowser() {
if (this.parsedResult.browser) {
return this.parsedResult.browser;
}
return this._parseBrowser();
}
/** /**
* Test a UA string for a regexp * Test a UA string for a regexp
* @param {RegExp} regex * @param {RegExp} regex