Skip to content

slugToPascalCase

slugToPascalCase(props): string

Defined in: packages/core/src/collections/utils.ts:90

Converts a collection slug to a PascalCase identifier for use in type names.

Splits on underscores and hyphens and capitalizes each segment.

Input props.

string

The collection slug, e.g. "blog_posts", "authors".

string

PascalCase string, e.g. "BlogPosts", "Authors".

slugToPascalCase({ slug: "blog_posts" }) // → "BlogPosts"
slugToPascalCase({ slug: "authors" }) // → "Authors"