MCPcopy Index your code
hub / github.com/devspace-sh/devspace / ensureSlash

Function ensureSlash

ui/config/paths.js:14–23  ·  view source on GitHub ↗
(path, needsSlash)

Source from the content-addressed store, hash-verified

12const envPublicUrl = process.env.PUBLIC_URL;
13
14function ensureSlash(path, needsSlash) {
15 const hasSlash = path.endsWith('/');
16 if (hasSlash && !needsSlash) {
17 return path.substr(path, path.length - 1);
18 } else if (!hasSlash && needsSlash) {
19 return `${path}/`;
20 } else {
21 return path;
22 }
23}
24
25const getPublicUrl = appPackageJson =>
26 envPublicUrl || require(appPackageJson).homepage;

Callers 1

getServedPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected