This library provides functionality to convert strings between different case formats while maintaining proper word boundary.
Supported case formats:
- lowerCamelCase
- UpperCamelCase (also called PascalCase)
- snake_case
- SHOUTY_SNAKE_CASE
- kebab-case
- SHOUTY-KEBAB-CASE
- Title Case
- Train-Case
This project is a Luau translation of the Rust crate heck: withoutboats/heck.
This package follows the Sea of Voices Luau Package Standard.
local Heck = require("@pkg/@seaofvoices/heck-luau")
-- Convert to different case formats
local result = Heck.toSnakeCase("helloWorld") -- "hello_world"
local result = Heck.toLowerCamelCase("hello_world") -- "helloWorld"
local result = Heck.toUpperCamelCase("hello_world") -- "HelloWorld"
local result = Heck.toPascalCase("hello_world") -- "HelloWorld" (alias for toUpperCamelCase)
local result = Heck.toKebabCase("helloWorld") -- "hello-world"
local result = Heck.toShoutySnakeCase("helloWorld") -- "HELLO_WORLD"
local result = Heck.toShoutyKebabCase("helloWorld") -- "HELLO-WORLD"
local result = Heck.toTitleCase("helloWorld") -- "Hello World"
local result = Heck.toTrainCase("helloWorld") -- "Hello-World"Add @seaofvoices/heck-luau in your dependencies:
yarn add @seaofvoices/heck-luauOr if you are using npm:
npm install @seaofvoices/heck-luauVersions of this library are also pre-built and linked to GitHub releases:
heck.rbxm: Roblox model file for Roblox Studioheck.luau: is a single-file version of the library
If you would like to use this library on a Lua or Luau environment where it is currently incompatible, open an issue (or comment on an existing one) to request the appropriate modifications.
The library uses darklua to process its code.
This project is available under the MIT license. See LICENSE.txt for details.