Skip to content

Global Helpers

hyphenize()

hyphenize() — returns string

Available in: controller, model, mapper, migrator, migration, tabledefinition Category: String Functions

Converts camelCase strings to lowercase strings with hyphens as word delimiters instead. Example: myVariable becomes my-variable.

NameTypeRequiredDefaultDescription
stringstringyes—The string to hyphenize.
// 1. Basic camelCase to hyphenated string
result = hyphenize("myBlogPost");
// result -> "my-blog-post"

// 2. Single word (no change)
result = hyphenize("hello");
// result -> "hello"

// 3. Used in URL slug generation
slug = hyphenize("userProfileSettings");
// slug -> "user-profile-settings"