MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / joinRel

Function joinRel

runtime/src/specs.js:27–42  ·  view source on GitHub ↗
(base, target)

Source from the content-addressed store, hash-verified

25};
26
27export const joinRel = (base, target) => {
28 if (target.includes('://') || target.startsWith('/')) return target;
29 if (base.includes('://')) return new URL(target, base).toString();
30 let b = base, t = target;
31 while (t.startsWith('../')) {
32 const p = parentDir(b); b = p == null ? '' : p;
33 t = t.slice(3);
34 }
35 if (t === '..') { const p = parentDir(b); return p == null ? '' : p; }
36 if (t === '.' || t === '') return b;
37 if (b !== '') {
38 while (t.startsWith('./')) t = t.slice(2);
39 if (!b.endsWith('/')) b += '/';
40 }
41 return b + t;
42};

Callers 3

enqueueImportFunction · 0.90
retryPendingFunction · 0.90
bfsPrefetchFunction · 0.90

Calls 1

parentDirFunction · 0.85

Tested by

no test coverage detected