MCPcopy Index your code
hub / github.com/docsifyjs/docsify / isExternal

Function isExternal

packages/docsify-server-renderer/index.js:16–40  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

14}
15
16function isExternal(url) {
17 let match = url.match(
18 /^([^:/?#]+:)?(?:\/\/([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/
19 );
20 if (
21 typeof match[1] === 'string' &&
22 match[1].length > 0 &&
23 match[1].toLowerCase() !== location.protocol
24 ) {
25 return true;
26 }
27 if (
28 typeof match[2] === 'string' &&
29 match[2].length > 0 &&
30 match[2].replace(
31 new RegExp(
32 ':(' + { 'http:': 80, 'https:': 443 }[location.protocol] + ')?$'
33 ),
34 ''
35 ) !== location.host
36 ) {
37 return true;
38 }
39 return false;
40}
41
42function mainTpl(config) {
43 let html = `<nav class="app-nav${

Callers 1

renderToStringMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…