Releases: goloop/scs
Releases · goloop/scs
Release list
v2.1.0
v2.0.1
scs v2 — String Case Style. A full redesign around a single universal tokenizer; not source-compatible with v1.
Migrating
- Import path:
github.com/goloop/scs/v2(wasgithub.com/goloop/scs). - Requires Go 1.24+.
- The lossy
StrTo*family and the twelve error-returning pairwise converters
(CamelToKebab,SnakeToPascal, …) are gone — use the totalTo*functions
orConvert. - The stateful
StringCaseStyleobject (New/Eat/Set/Value/
CopyTo*) is replaced by pure functions and the immutableCaser. - Output change: case boundaries are preserved —
ToSnake("userID")is now
user_id, notuserid.
Highlights
- Total converters:
ToCamel/ToPascal/ToSnake/ToKebabtake a
string and return a string, never error, and handle input already in any style
— every style renders from one tokenizer, exposed asSplitandWords
(iter.Seq). - New styles:
ToScreamingSnake,ToDot,ToTitle,ToSentence. - Runtime styles:
Convert(style, s),ParseStyle,Style.String/
Style.Valid;Detect(single-match contract) and the genericIs(style, s). - Acronyms: default Title casing (
Http,Api,Id) always round-trips;
all-caps initialisms are opt-in through the reusable, concurrency-safeCaser
(New,WithAcronyms). - Fixed: adjacent words no longer merge into an unsplittable block by
default; digits attach to neighboring letters (only an explicit separator
splits a number out); number handling is consistent across every entry point.