Skip to content
seaofvoicesPublic

About

Case conversion library for Luau with Unicode support

Resources

Code of conduct

Stars

8 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

checks version GitHub top language license npm Read on Medium

ko-fi

heck-luau

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.

Usage

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"

Installation

Add @seaofvoices/heck-luau in your dependencies:

yarn add @seaofvoices/heck-luau

Or if you are using npm:

npm install @seaofvoices/heck-luau

Pre-built Assets

Versions of this library are also pre-built and linked to GitHub releases:

  • heck.rbxm: Roblox model file for Roblox Studio
  • heck.luau: is a single-file version of the library

Other Environments Support

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.

License

This project is available under the MIT license. See LICENSE.txt for details.

About

Case conversion library for Luau with Unicode support

Resources

Code of conduct

Stars

8 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages