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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.