@withstudiocms/internal_helpers
Version:
Internal helper utilities for StudioCMS
21 lines (20 loc) • 1.29 kB
TypeScript
/** Get the a root-relative URL path with the site’s `base` prefixed. */
export declare function pathWithBase(path: string): string;
/** Get the a root-relative file URL path with the site’s `base` prefixed. */
export declare function fileWithBase(path: string): string;
/** Ensure the passed path starts with a leading slash. */
export declare function ensureLeadingSlash(href: string): string;
/** Ensure the passed path ends with a trailing slash. */
export declare function ensureTrailingSlash(href: string): string;
/** Ensure the passed path starts and ends with slashes. */
export declare function ensureLeadingAndTrailingSlashes(href: string): string;
/** Ensure the passed path does not start with a leading slash. */
export declare function stripLeadingSlash(href: string): string;
/** Ensure the passed path does not end with a trailing slash. */
export declare function stripTrailingSlash(href: string): string;
/** Ensure the passed path does not start and end with slashes. */
export declare function stripLeadingAndTrailingSlashes(href: string): string;
/** Remove the extension from a path. */
export declare function stripHtmlExtension(path: string): string;
/** Add '.html' extension to a path. */
export declare function ensureHtmlExtension(path: string): string;