From 93b97e1641de1580c9d734dda81a634265a94816 Mon Sep 17 00:00:00 2001 From: ciatph Date: Fri, 13 Sep 2024 04:19:49 +0800 Subject: [PATCH] docs: update class member doc --- README.md | 3 +- app/src/classes/colorlog/index.js | 38 +++++++++++++++++-- app/src/classes/excel/index.js | 61 ++++++++++++++++++++++++------- app/src/classes/schema/index.js | 5 ++- 4 files changed, 88 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 11472e7..0d37f02 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,9 @@ Pre-compiled windows binaries are available for download in the latest [Releases ## Class Documentation -- Class documentation and methods are available at https://ciatph.github.io/ph-municipalities. +- Class and methods documentation are available at https://ciatph.github.io/ph-municipalities. - The documentation website's HTML files are available in the [`gh-pages`](https://github.com/ciatph/ph-municipalities/tree/gh-pages) branch of this repository. +- Class source codes are available at https://github.com/ciatph/ph-municipalities. - Refer to the [Building the Class Documentation](#building-the-class-documentation) section for more information about updating and building the class documentation. ## Requirements diff --git a/app/src/classes/colorlog/index.js b/app/src/classes/colorlog/index.js index 7ab025a..e2a09de 100644 --- a/app/src/classes/colorlog/index.js +++ b/app/src/classes/colorlog/index.js @@ -1,13 +1,34 @@ /** * Prints colored console.log messages - * @class */ class ColorLog { + /** + * Text styles for logging. + * @static + * @type {Object.} + * @property {string} BOLD - Bold text style. + * @property {string} NORMAL - Normal text style. + */ static TEXT = { BOLD: '\x1b[1m', NORMAL: '\x1b[0m' } + /** + * ANSI colors for coloring the logging text. + * @static + * @type {Object.} + * @property {Object} TEXT - Object containing color properties. + * @property {string} TEXT.WHITE - White color. + * @property {string} TEXT.GRAY - Gray color. + * @property {string} TEXT.GREEN - Green color. + * @property {string} TEXT.RED - Red color. + * @property {string} TEXT.YELLOW - Yellow color. + * @property {string} TEXT.BLUE - Blue color. + * @property {string} TEXT.CYAN - Cyan color. + * @property {string} TEXT.RESET - Reset color. + * @property {string} TEXT.MAGENTA - Magenta color. + */ static COLORS = { TEXT: { WHITE: '\x1b[37m', @@ -22,13 +43,22 @@ class ColorLog { } } - /** Message log */ + /** + * Message log text. + * @type {string | null} + */ #log = null - /** Text color */ + /** + * Text color + * @type {string} + */ #color = ColorLog.COLORS.TEXT.GREEN - /** Text weight (bold, normal) */ + /** + * Text weight (bold, normal) + * @type {string} + */ #weight = false /** diff --git a/app/src/classes/excel/index.js b/app/src/classes/excel/index.js index 6c36240..ab73c88 100644 --- a/app/src/classes/excel/index.js +++ b/app/src/classes/excel/index.js @@ -17,22 +17,40 @@ const { capitalizeText } = require('../../lib/utils') * "municipalityName (ProvinceName)" */ class ExcelFile { - /** Remote download URL of an excel file */ + /** + * Remote download URL of an excel file + * @type {string | null} + */ #url = null - /** Full file path to excel file on local storage */ + /** + * Full file path to excel file on local storage + * @type {string | null} + */ #pathToFile = null - /** Region information from the /app/config/regions.json or other config file */ + /** + * Region information from the `/app/config/regions.json` or other JSON config file. + * @type {Object | null} + */ #settings = null - /** 10-day Excel file information */ + /** + * 10-day Excel file information + * @type {Object.} + */ #metadata = { - // Weather forecast date + /** + * Weather forecast date + * @type {string | null} + */ forecastDate: null } - /** Other app settings and configurations */ + /** + * Other app settings and configurations + * @type {Object.} + */ #options = { /** * SheetJS array index number translated from the Excel headers row count @@ -49,26 +67,43 @@ class ExcelFile { SHEETJS_COL: process.env.SHEETJS_COLUMN || '__EMPTY' } - /** Excel workbook object parsed by sheetjs */ + /** + * Excel workbook object parsed by sheetjs + * @type {Object[] | null} + */ #workbook = null - /** Excel sheet names parsed by sheetjs */ + /** + * Excel sheet names parsed by sheetjs. + * @type {string[] | null} + */ #sheets = null - /** Objects[] Array corresponding to excel rows extracted from the excel sheet by sheetjs */ + /** + * Objects[] Array corresponding to excel rows extracted from the excel sheet by sheetjs. + * @type {Object[] | null} + */ #data = null - /** Object[] Array of processed string corresponding to the column in the excel file - * that contains the list of municipalities following the pattern: + /** + * Object[] Array of processed string corresponding to the column in the excel file + * that contains the list of municipalities following the pattern: * "municipalityName (provinceName)" * Content: [{ municipality, province }, ... ] + * @type {Object[] | null} */ #datalist = [] - /** Event emitter for listening to custom events */ + /** + * Node event emitter for listening to custom events. + * @type {Function} + */ events = new EventEmitter() - /** List of EventEmitter events */ + /** + * List of EventEmitter events. + * @type {Object.} + */ EVENTS = { LOADED: 'loaded' } diff --git a/app/src/classes/schema/index.js b/app/src/classes/schema/index.js index 6e4c960..2603450 100644 --- a/app/src/classes/schema/index.js +++ b/app/src/classes/schema/index.js @@ -2,7 +2,10 @@ * Validates Objects with [zod](https://github.com/colinhacks/zod) schemas and formats validation error(s) for log output. */ class Schema { - /** Settings object */ + /** + * Settings object. + * @type {Object | null} + */ #data = null /**