next.js/packages/next/src/shared/lib/page-path/ensure-leading-slash.ts
ensure-leading-slash.ts8 lines262 B
/**
 * For a given page path, this function ensures that there is a leading slash.
 * If there is not a leading slash, one is added, otherwise it is noop.
 */
export function ensureLeadingSlash(path: string) {
  return path.startsWith('/') ? path : `/${path}`
}
Quest for Codev2.0.0
/
SIGN IN