diff --git a/src/bowser.js b/src/bowser.js index 45a5659..57b8fd6 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -40,7 +40,7 @@ class Bowser { * @return {ParsedResult} */ static parse(UA) { - return (new Bowser(UA)).getResult(); + return (new Parser(UA)).getResult(); } } diff --git a/src/utils.js b/src/utils.js index 666a597..b40a849 100644 --- a/src/utils.js +++ b/src/utils.js @@ -78,6 +78,7 @@ class Utils { * @return {Number} comparison result: -1 when versionA is lower, * 1 when versionA is bigger, 0 when both equal */ + /* eslint consistent-return: 1 */ static compareVersions(versionA, versionB) { // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2 let precision = Math.max( diff --git a/test/acceptance/test-list-of-ua.js b/test/acceptance/test-list-of-ua.js index b386e40..e050b65 100644 --- a/test/acceptance/test-list-of-ua.js +++ b/test/acceptance/test-list-of-ua.js @@ -10,7 +10,7 @@ const browserNames = Object.keys(listOfUA); browserNames.forEach((browserName) => { listOfUA[browserName].forEach((browser) => { test('Check all the test browsers', (t) => { - const parsed = new Bowser(browser.ua).parse().getResult(); + const parsed = Bowser.parse(browser.ua); t.deepEqual(parsed, browser.spec, `${browser.ua}`); t.is(parsed.browser.name, browserName, `${browser.ua}`); }); diff --git a/test/unit/bowser.js b/test/unit/bowser.js index 4cd48a7..a27b2c9 100644 --- a/test/unit/bowser.js +++ b/test/unit/bowser.js @@ -3,14 +3,14 @@ import Bowser from '../../src/bowser'; import Parser from '../../src/parser'; const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 OPR/43.0.2442.1165'; -const browser = new Bowser(UA); +const browser = Bowser.getParser(UA); test('Bowser`s constructor returns a Parser instance', (t) => { t.truthy(browser instanceof Parser); }); test('Bowser`s constructor fails if UA is empty', (t) => { - t.throws(() => (new Bowser())); + t.throws(() => (Bowser.getParser())); }); test('Bowser.parse parses UA and returns result', (t) => {