Skip to content

toRouteSegment

Lowercase a path segment for use in an ON-DISK file/dir name. The routes themselves are case-preserved via an explicit slug: frontmatter (see toRouteSegmentPreserveCase), but the files stay lowercase (and numerically disambiguated) so two type names differing only by case cannot collide on Windows’ case-insensitive filesystem.

Import:

import { toRouteSegment } from '@mnaoumov/typescript-dev-toolkit/docs-site/api-doc-route-segments';

Signature:

function toRouteSegment(segment: string): string

Parameters:

Parameter Type Description
segment string The segment.

Returns: string — The lowercased segment.