MCPcopy Index your code
hub / github.com/OpenSignLabs/OpenSign / removeTrailingSegment

Function removeTrailingSegment

apps/OpenSign/src/constant/Utils.js:237–249  ·  view source on GitHub ↗
(url, segment = "app")

Source from the content-addressed store, hash-verified

235 * @returns {string} - The URL with the trailing segment removed, or unmodified if it didn’t match.
236 */
237export function removeTrailingSegment(url, segment = "app") {
238 // Normalize a trailing slash (e.g. “/app/” → “/app”)
239 const normalized = url.endsWith("/") ? url.slice(0, -1) : url;
240
241 const lastSlash = normalized.lastIndexOf("/");
242 const lastPart = normalized.slice(lastSlash + 1);
243
244 if (lastPart === segment) {
245 return normalized.slice(0, lastSlash);
246 }
247
248 return normalized;
249}
250
251export const color = [
252 "#93a3db",

Callers 2

FormsFunction · 0.90
decryptPdfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected