MCPcopy Index your code
hub / github.com/nodejs/node / assertValidUrl

Function assertValidUrl

deps/npm/lib/utils/open-url.js:7–15  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

5const { once } = require('node:events')
6
7const assertValidUrl = (url) => {
8 try {
9 if (!/^https?:$/.test(new URL(url).protocol)) {
10 throw new Error()
11 }
12 } catch {
13 throw new Error('Invalid URL: ' + url)
14 }
15}
16
17const outputMsg = (json, title, url) => {
18 if (json) {

Callers 2

openUrlFunction · 0.85
openUrlPromptFunction · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…