MCPcopy Create free account
hub / github.com/Packstack-Tech/packstack / ensureSlash

Function ensureSlash

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

Source from the content-addressed store, hash-verified

12const envPublicUrl = process.env.PUBLIC_URL;
13
14function ensureSlash(inputPath, needsSlash) {
15 const hasSlash = inputPath.endsWith('/');
16 if (hasSlash && !needsSlash) {
17 return inputPath.substr(0, inputPath.length - 1);
18 } else if (!hasSlash && needsSlash) {
19 return `${inputPath}/`;
20 } else {
21 return inputPath;
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