MCPcopy
hub / github.com/ternjs/tern / resolvePath

Function resolvePath

plugin/node_resolve.js:63–70  ·  view source on GitHub ↗
(base, path)

Source from the content-addressed store, hash-verified

61
62 })(); else (function() {
63 function resolvePath(base, path) {
64 if (path[0] == "/") return path;
65 var slash = base.lastIndexOf("/"), m;
66 if (slash >= 0) path = base.slice(0, slash + 1) + path;
67 while (m = /[^\/]*[^\/\.][^\/]*\/\.\.\//.exec(path))
68 path = path.slice(0, m.index) + path.slice(m.index + m[0].length);
69 return path.replace(/(^|[^\.])\.\//g, "$1");
70 }
71
72 resolveToFile = function(name, parentFile) {
73 return /^\.\.?\//.test(name) ? resolvePath(parentFile, name) : name;

Callers 1

node_resolve.jsFile · 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…