casing

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package casing provides case-format constants and validators used by commit lint rules. Each format has a corresponding exported predicate and a shared Check dispatcher.

Index

Constants

View Source
const (
	Lower    = "lower-case"    // all characters lower-cased, e.g. "feat"
	Upper    = "upper-case"    // all characters upper-cased, e.g. "FEAT"
	Camel    = "camel-case"    // starts lowercase, no separators, e.g. "myFeat"
	Kebab    = "kebab-case"    // lowercase words joined by hyphens, e.g. "my-feat"
	Pascal   = "pascal-case"   // starts uppercase, no separators, e.g. "MyFeat"
	Sentence = "sentence-case" // first letter uppercase, rest lowercase, e.g. "My feat"
	Snake    = "snake-case"    // lowercase words joined by underscores, e.g. "my_feat"
	Start    = "start-case"    // every word starts uppercase, e.g. "My Feat"
)

Case-format constants. These are the only values accepted by rules that take a case argument (e.g. type-case, scope-case, …).

Variables

All is the ordered list of all valid case formats.

Functions

func Check

func Check(s, caseFormat string) bool

Check returns true when s conforms to the given caseFormat constant. An empty string always returns true (treated as "not present"). Returns false for any unrecognised caseFormat value.

func IsCamelCase

func IsCamelCase(s string) bool

IsCamelCase reports whether s is in camelCase format. camelCase: starts with a lowercase letter and contains only letters and digits (no separators). Examples: "feat", "myFeature", "parseHTML".

func IsKebabCase

func IsKebabCase(s string) bool

IsKebabCase reports whether s is in kebab-case format. kebab-case: only lowercase letters, digits, and hyphens. Examples: "my-feature", "kebab-case", "v2-api".

func IsPascalCase

func IsPascalCase(s string) bool

IsPascalCase reports whether s is in PascalCase format. PascalCase: starts with an uppercase letter and contains only letters and digits (no separators). Examples: "MyFeature", "ParseHTML", "Feat".

func IsSentenceCase

func IsSentenceCase(s string) bool

IsSentenceCase reports whether s is in Sentence case format. Sentence case: first rune is uppercase; every subsequent letter is lowercase. Digits and punctuation are allowed anywhere. Examples: "My feature", "Add endpoint", "Fix #123".

func IsSnakeCase

func IsSnakeCase(s string) bool

IsSnakeCase reports whether s is in snake_case format. snake_case: only lowercase letters, digits, and underscores. Examples: "my_feature", "snake_case", "v2_api".

func IsStartCase

func IsStartCase(s string) bool

IsStartCase reports whether s is in Start Case format. Start Case: every whitespace-separated word starts with an uppercase letter. Examples: "My Feature", "Add New Endpoint".

Types

This section is empty.

Jump to

Keyboard shortcuts

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