From c2c9d215f7697af0365c3e09023512299d2f5d33 Mon Sep 17 00:00:00 2001 From: Bram van der Veen <96aa48@gmail.com> Date: Sun, 16 Aug 2015 13:42:14 +0200 Subject: [PATCH] Added documentation to group modules together. --- api.js | 5 +++++ auth.js | 4 ++++ configuration.js | 6 +++++- crypt.js | 5 +++++ database.js | 7 ++++++- lookup.js | 4 ++++ redirecter.js | 5 +++++ schedule.js | 5 +++++ spider.js | 5 +++++ time.js | 8 +++++++- web.js | 6 ++++++ 11 files changed, 57 insertions(+), 3 deletions(-) diff --git a/api.js b/api.js index fde42ae..ff47fb7 100644 --- a/api.js +++ b/api.js @@ -1,4 +1,9 @@ //api.js +/** + * Module for handling API requests. + * API is able to be called through /api/:apirequest?=arguments + * @module api + */ //Importing self-written modules. var lookup = require('./lookup'); diff --git a/auth.js b/auth.js index 753dedd..9300146 100644 --- a/auth.js +++ b/auth.js @@ -1,4 +1,8 @@ //auth.js +/** + * Module for handling the Authentication in the web application. + * @module auth + */ //Importing first and third-party modules. var qs = require('querystring'); diff --git a/configuration.js b/configuration.js index e4ba731..c005c0b 100644 --- a/configuration.js +++ b/configuration.js @@ -1,10 +1,14 @@ //configuration.js +/** + * Module for the return/creating of a settings file/object. + * @module configuration + */ //Import first-party modules. var fs = require('fs'); /** - * Module for the return/creating of a settings file/object. + * Function for the return/creating of a settings file/object. * @return {Object} settings - Object of all the settings. */ module.exports = function () { diff --git a/crypt.js b/crypt.js index d2d6746..fc394f0 100644 --- a/crypt.js +++ b/crypt.js @@ -1,4 +1,8 @@ //crypt.js +/** + * Module for encrypting and decrypting strings. + * @module crypt + */ //Import first-party modules. var crypto = require('crypto'); @@ -30,6 +34,7 @@ function encrypt(str) { /** * Function to decrypt a string. * @param {String} str - String you want to decrypt + * @return {String} The decrypted string. */ function decrypt(str) { var decryptArray = []; diff --git a/database.js b/database.js index 9cae635..1154d69 100644 --- a/database.js +++ b/database.js @@ -1,4 +1,9 @@ //database.js +/** + * Module for using a database interface + * Either local (NeDB) or remote (MongoDB) based on configuration values. + * @module database + */ //Import first-party modules. var fs = require('fs'); @@ -7,7 +12,7 @@ var fs = require('fs'); var config = require('./configuration'); /** - * Module for using a database interface. + * Function for using a database interface. * Either local (NeDB) or remote (MongoDB). * @return {Object} database - Entire database engine (NeDB/MongoDB). */ diff --git a/lookup.js b/lookup.js index 76577f7..fcb692e 100644 --- a/lookup.js +++ b/lookup.js @@ -1,4 +1,8 @@ //lookup.js +/** + * Module for handling lookup requests by the user supplied search query. + * @module lookup + */ //Importing first-party modules. var fs = require('fs'); diff --git a/redirecter.js b/redirecter.js index 5c5bc4b..c5a1bd9 100644 --- a/redirecter.js +++ b/redirecter.js @@ -1,4 +1,9 @@ //redirecter.js +/** + * Module for redirecting the user based on what they typed into search. + * @module redirecter + */ + //Import first-party modules. var qs = require('querystring'); diff --git a/schedule.js b/schedule.js index d4d2e4c..217fd91 100644 --- a/schedule.js +++ b/schedule.js @@ -1,4 +1,9 @@ //schedule.js +/** + * Module for parsing downloaded schedule pages into useable/readable JSON objects. + * Usually used after a lookup with the supplied information from it. + * @module schedule + */ //Import first-party modules. var url = require('url'); diff --git a/spider.js b/spider.js index e7eee97..d8353f2 100644 --- a/spider.js +++ b/spider.js @@ -1,4 +1,9 @@ //spider.js +/** + * Module/script for getting students, teachers, chambers and groups from the schedule website. + * This script needs to be run before using the application, as the website will have no information to run on. + * @module spider + */ //Import first-party modules. var url = require('url'); diff --git a/time.js b/time.js index ddcad17..d649896 100644 --- a/time.js +++ b/time.js @@ -1,4 +1,10 @@ //time.js +/** + * Module handling time related tasks. + * Used for adding frontend features like showing what hour it currently is or + * changing color because the school day is over. + * @module time + */ //Importing self-written modules. var config = require('./configuration'); @@ -31,7 +37,7 @@ function parse(timestr) { /** * Function for parsing and checking if the currrent time is within the parsed string. * @param {String} timespan - A string containing a time from and to (e.g "9:15 - 10:00") - * @return {Boolean} - Returns true if the current time is within the timespan or false when it's not. + * @return {Boolean} Returns true if the current time is within the timespan or false when it's not. */ function withinTimespan(timespan) { if (get() > parse(timespan)[0] && get() < parse(timespan)[1]) return true; diff --git a/web.js b/web.js index 7b0c0ee..738ea30 100644 --- a/web.js +++ b/web.js @@ -1,4 +1,10 @@ //web.js +/** + * Module/script for setting up the web frontend and binding all of the modules + * together. + * @module web + */ + //Import first-party modules. var fs = require('fs');