MCPcopy Index your code
hub / github.com/tleunen/babel-plugin-module-resolver / toLocalPath

Function toLocalPath

src/utils.js:20–26  ·  view source on GitHub ↗
(modulePath)

Source from the content-addressed store, hash-verified

18}
19
20export function toLocalPath(modulePath) {
21 let localPath = modulePath.replace(/\/index$/, ''); // remove trailing /index
22 if (!isRelativePath(localPath)) {
23 localPath = `./${localPath}`; // insert `./` to make it a relative path
24 }
25 return localPath;
26}
27
28export function stripExtension(modulePath, stripExtensions) {
29 let name = path.basename(modulePath);

Callers 2

getRelativePathFunction · 0.90

Calls 1

isRelativePathFunction · 0.85

Tested by

no test coverage detected