Implement downloadable tokenizers

Closes #2574, #2754
This commit is contained in:
Cohee
2024-09-06 16:28:34 +00:00
parent 4a9401bfe2
commit 81251b073a
6 changed files with 187 additions and 10 deletions

View File

@ -647,6 +647,20 @@ function getSeparator(n) {
return '='.repeat(n);
}
/**
* Checks if the string is a valid URL.
* @param {string} url String to check
* @returns {boolean} If the URL is valid
*/
function isValidUrl(url) {
try {
new URL(url);
return true;
} catch (error) {
return false;
}
}
module.exports = {
getConfig,
getConfigValue,
@ -676,4 +690,5 @@ module.exports = {
makeHttp2Request,
removeColorFormatting,
getSeparator,
isValidUrl,
};