From 5a235015aa2eeb156f72169aaaff74e43e861786 Mon Sep 17 00:00:00 2001 From: Denis Demchenko Date: Thu, 8 Jun 2017 20:51:04 +0300 Subject: [PATCH] Add jsdoc descriptions for Parser's methods --- src/parser.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/parser.js b/src/parser.js index c56f294..43a5c7c 100644 --- a/src/parser.js +++ b/src/parser.js @@ -91,12 +91,29 @@ class Parser { } + /** + * Get browser's version + * @return {String} version of browser + * + * @public + */ getBrowserVersion() { return this.getBrowser().version; } getPlatform(){} + /** + * Get OS + * @return {Object} + * + * @example + * this.getOS(); + * { + * name: 'macOS', + * version: '10.11.12' + * } + */ getOS() { if (this.parsedResult.os) { return this.parsedResult.os; @@ -105,6 +122,11 @@ class Parser { return this._parseOS(); } + /** + * Parse OS and save it to this.parsedResult.os + * @return {*|{}} + * @private + */ _parseOS() { this.parsedResult.os = {}; @@ -129,10 +151,18 @@ class Parser { return this.parsedResult.os; } + /** + * Get OS name + * @return {String} name of the OS — macOS, Windows, Linux, etc. + */ getOSName() { return this.getOS().name; } + /** + * Get OS version + * @return {String} full version with dots ('10.11.12', '5.6', etc) + */ getOSVersion() { return this.getOS().version; }