Merge branch 'master' into prettier

This commit is contained in:
2024-02-22 21:23:39 +01:00
2479 changed files with 4362 additions and 549539 deletions

View File

@ -1,3 +1,9 @@
/**
* TODOC
* TODO: document so we can improve this
* @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) {