amirfarzamnia/caseluau

A simple and lightweight Luau library for converting strings between different cases.

Case.luau

License: MIT

A simple and lightweight Luau library for converting strings between different cases.

Installation

To install, use pesde:

pesde add amirfarzamnia/caseluau

Usage

local case = require("@amirfarzamnia/caseluau")

-- camelCase
print(case.camel("hello world")) -- "helloWorld"

-- PascalCase
print(case.pascal("hello world")) -- "HelloWorld"

-- snake_case
print(case.snake("hello world")) -- "hello_world"

-- CONSTANT_CASE
print(case.constant("hello world")) -- "HELLO_WORLD"

-- kebab-case
print(case.kebab("hello world")) -- "hello-world"

-- dot.case
print(case.dot("hello world")) -- "hello.world"

-- path/case
print(case.path("hello world")) -- "hello/world"

-- Sentence case
print(case.sentence("hello world")) -- "Hello world"

-- Title Case
print(case.title("hello world")) -- "Hello World"

-- UPPER CASE
print(case.upper("hello world")) -- "HELLO WORLD"

-- lower case
print(case.lower("HELLO WORLD")) -- "hello world"

API

The following functions are available:

  • case.camel(text: string): string
  • case.constant(text: string): string
  • case.dot(text: string): string
  • case.kebab(text: string): string
  • case.lower(text: string): string
  • case.pascal(text: string): string
  • case.path(text: string): string
  • case.sentence(text: string): string
  • case.snake(text: string): string
  • case.title(text: string): string
  • case.upper(text: string): string

License

This project is licensed under the MIT License - see the LICENSE file for details.