Skip to content

Commit e996acb

Browse files
committed
Improves/extends doc comments
1 parent 8c79ec2 commit e996acb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

htmlpreview.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* If the first parameter is a URL to a file on a known git forge,
99
* returns the URL to the raw version of this file
1010
* (vs the HTML/Web view of it).
11+
* @returns {string} The raw version of the (git hosted) file URL
12+
* requested to be previewed.
1113
*
1214
* NOTE: This function 1 of 2 that is git-forge specific.
1315
*/
@@ -18,8 +20,11 @@
1820
};
1921

2022
/**
21-
* Returns whether the given URL points to a file on a known git forge.
22-
* @param {string} url - Any URL
23+
* Indicates whether the given URL points to a file on a known git forge.
24+
* @param {string} url - Any URL,
25+
* potentially pointing to a git hosted raw (plain-text) file
26+
* @returns {boolean} `true` if the given URL indeed does point
27+
* to a git hosted raw file
2328
*
2429
* NOTE: This is function 2 of 2 that is git-forge specific.
2530
*/
@@ -32,6 +37,7 @@
3237
* Returns whether the given URL points to an HTML file,
3338
* considering only the file extension.
3439
* @param {string} url - Any URL
40+
* @returns {boolean} 'true' if the given URL points to an HTML file.
3541
*/
3642
const isHtmlUrl = function (url) {
3743
return (url.indexOf('.html') > 0 || url.indexOf('.htm') > 0);
@@ -40,6 +46,7 @@
4046
/**
4147
* Returns the base URL of our service,
4248
* to which the git hosted file URL can be appended.
49+
* @returns {string} a URL representing the our service base.
4350
*/
4451
const getServiceBase = function () {
4552
if (window.location) {
@@ -54,6 +61,7 @@
5461
/**
5562
* Rewrite URL so it can be loaded using CORS proxy.
5663
* @param {string} url - Any URL
64+
* @returns {string} The re-routed (for preview) version of the provided URL
5765
*/
5866
const rewrite = function (url) {
5967
return location.origin + location.pathname + '?' + url;
@@ -64,6 +72,7 @@
6472
* if it points to a file on a known git forge.
6573
* @param {object} obj - An object containing a property that is a URL
6674
* @param {string} prop - The name of the URL property
75+
* @returns {void}
6776
*/
6877
const rewriteCond = function (obj, prop) {
6978
// Get absolute URL

0 commit comments

Comments
 (0)