UNPKG

@mintlify/common

Version:

Commonly shared code within Mintlify

20 lines (19 loc) 537 B
import { isRemoteSchemaUrl } from '../schema/common.js'; export function optionallyAddLeadingSlash(filePath) { if (filePath.startsWith('/') || isRemoteSchemaUrl(filePath)) { return filePath; } return '/' + filePath; } export function optionallyRemoveLeadingSlash(filePath) { if (filePath.startsWith('/')) { return filePath.slice(1); } return filePath; } export function optionallyRemoveTrailingSlash(path) { if (path.endsWith('/')) { return path.slice(0, -1); } return path; }