node-llama-cpp
Version:
Run AI models locally on your machine with node.js bindings for llama.cpp. Enforce a JSON schema on the model output on the generation level
15 lines • 432 B
JavaScript
export function isUrl(text, throwOnInvalidUrl = true) {
if (text.toLowerCase().startsWith("http://") || text.toLowerCase().startsWith("https://")) {
try {
new URL(text);
return true;
}
catch {
if (throwOnInvalidUrl)
throw new Error(`Invalid URL: ${text}`);
return false;
}
}
return false;
}
//# sourceMappingURL=isUrl.js.map