MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / resolve

Function resolve

src/utils/Path.js:142–158  ·  view source on GitHub ↗

* Resolve the path eg. ```js resolvePath('path/to/some/dir/', '../../dir') //returns 'path/to/dir' ``` * @param {...string} paths

(...paths)

Source from the content-addressed store, hash-verified

140 * @param {...string} paths
141 */
142 resolve(...paths) {
143 if (!paths.length) throw new Error("resolve(...path) : Arguments missing!");
144
145 let result = "";
146
147 paths.forEach((path) => {
148 if (path.startsWith("/")) {
149 result = path;
150 return;
151 }
152
153 result = this.normalize(this.join(result, path));
154 });
155
156 if (result.startsWith("/")) return result;
157 else return "/" + result;
158 },
159
160 /**
161 * Gets path for path2 relative to path1

Callers 15

getStrFunction · 0.85
getFreePortFunction · 0.85
spawnAsyncFunction · 0.85
launchAppFunction · 0.85
createSessionMethod · 0.85
connectToSessionMethod · 0.85
resizeTerminalMethod · 0.85
terminateMethod · 0.85
createTerminalMethod · 0.85
initEncodingsFunction · 0.85
execDecodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected