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

Fix the docs

This commit is contained in:
Denis Demchenko
2019-01-19 15:44:08 +02:00
parent cab0d0d946
commit a87ccad88a
9 changed files with 89 additions and 34 deletions

View File

@@ -358,8 +358,7 @@ class Parser {
* @return {ParsedResult}
*/
getResult() {
/* TODO: Make this function pure, return a new object instead of the reference */
return this.parsedResult;
return Object.assign({}, this.parsedResult);
}
/**
@@ -438,7 +437,7 @@ class Parser {
}
compareVersion(version) {
let expectedResult = 0;
let expectedResults = [0];
let comparableVersion = version;
let isLoose = false;
@@ -448,12 +447,19 @@ class Parser {
return void 0;
}
if (version[0] === '>') {
expectedResult = 1;
comparableVersion = version.substr(1);
} else if (version[0] === '<') {
expectedResult = -1;
if (version[0] === '>' || version[0] === '<') {
comparableVersion = version.substr(1);
if (version[1] === '=') {
isLoose = true;
comparableVersion = version.substr(2);
} else {
expectedResults = [];
}
if (version[0] === '>') {
expectedResults.push(1);
} else {
expectedResults.push(-1);
}
} else if (version[0] === '=') {
comparableVersion = version.substr(1);
} else if (version[0] === '~') {
@@ -461,7 +467,9 @@ class Parser {
comparableVersion = version.substr(1);
}
return compareVersions(currentBrowserVersion, comparableVersion, isLoose) === expectedResult;
return expectedResults.indexOf(
compareVersions(currentBrowserVersion, comparableVersion, isLoose),
) > -1;
}
isOS(osName) {
@@ -483,7 +491,7 @@ class Parser {
}
/**
* Check if any of the given values satifies this.is(anything)
* Check if any of the given values satisfies this.is(anything)
* @param {String[]} anythings
* @returns {Boolean}
*/
@@ -507,7 +515,7 @@ export default Parser;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Oct 19 2018 19:31:53 GMT+0200 (Central European Summer Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Jan 19 2019 15:43:45 GMT+0200 (EET) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>