lodashcase

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package lodashcase converts identifiers between camel, kebab and snake case the way lodash does.

Splitting a name into words is the whole difficulty: lodash breaks on case changes, on the boundary between letters and digits, and on runs of capitals followed by a lowercase letter, so HTTPRequest2 is HTTP, Request, 2. The case operations rely on that, and ReplaceVariableNames applies it to the identifiers in a piece of source while leaving everything else alone.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(s string) string

CamelCase joins the words of s with each after the first capitalised.

func KebabCase

func KebabCase(s string) string

KebabCase joins the words of s with hyphens, all lower case.

func ReplaceVariableNames

func ReplaceVariableNames(input string, replacer func(string) string) string

ReplaceVariableNames applies replacer to identifier-like tokens, leaving quoted strings and escaped quotes untouched (a port of lib/Code.mjs).

func SnakeCase

func SnakeCase(s string) string

SnakeCase joins the words of s with underscores, all lower case.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL