From a04aed0d6774a512bcc34c7246986095323be9bd Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Sat, 27 Apr 2019 13:24:50 +0100 Subject: [PATCH] Add function docs for parse utils --- app/src/parse.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/parse.js b/app/src/parse.js index 4db75fc3..e65e2685 100644 --- a/app/src/parse.js +++ b/app/src/parse.js @@ -1,11 +1,13 @@ /** * Utility functions for parsing + * */ /** * Parse a string as positive integer or NaN * * @param {string} value + * @returns {number} integer or NaN */ function strictParseInt(value) { if (/^([1-9][0-9]*)$/.test(value)) @@ -13,7 +15,12 @@ function strictParseInt(value) { return NaN; } - +/** + * Parse building ID from URL + * + * @param {String} url + * @returns {number|undefined} + */ function parseBuildingURL(url) { const re = /\/building\/([^/]+).html/; const matches = re.exec(url); @@ -24,6 +31,12 @@ function parseBuildingURL(url) { return undefined; } +/** + * Parse category slug from URL + * + * @param {String} url + * @returns {String} [age] + */ function parseCategoryURL(url) { const default_cat = 'age'; if (url === "/") {