doc: add JSDoc annotations in the core folder

start documenting a bit, mostly inconsequential changes
This commit is contained in:
2024-02-19 19:12:42 +01:00
parent 4f869252a2
commit ce5ca1875b
7 changed files with 600 additions and 12 deletions

View File

@ -1,3 +1,9 @@
/**
* TODOC
* TODO: document so we can make this improve
* @param {*} url
* @returns
*/
function parseUrl(url) {
// XXX: Hack.
let match = url.match(new RegExp("(\\w+)://([^/:]+)(?::(\\d+))?(.*)"));
@ -9,6 +15,11 @@ function parseUrl(url) {
};
}
/**
* TODOC
* @param {*} data
* @returns
*/
function parseResponse(data) {
let firstLine;
let headers = {};
@ -28,6 +39,13 @@ function parseResponse(data) {
return {body: data};
}
/**
* TODOC
* @param {*} url
* @param {*} options
* @param {*} allowed_hosts
* @returns
*/
export function fetch(url, options, allowed_hosts) {
let parsed = parseUrl(url);
return new Promise(function(resolve, reject) {