@@ -21,7 +21,7 @@ type Caps struct {
2121type CapsOpts struct {
2222 // Any characters within this string will be allowed in the output.
2323 //
24- // This does not affect delimiters (e.g. '_', '-', '.' ) as they are added
24+ // This does not affect delimiters (e.g. "_", "-", "." ) as they are added
2525 // post-tokenization.
2626 //
2727 // Default:
@@ -30,7 +30,7 @@ type CapsOpts struct {
3030 // The Converter to use.
3131 //
3232 // Default:
33- // DefaultConverter
33+ // A StdConverter with the Replacements, Caser, and Tokenizer.
3434 Converter Converter
3535
3636 // If not set, this will be DefaultReplacements.
@@ -59,7 +59,7 @@ type CapsOpts struct {
5959 // functions)
6060 Caser token.Caser
6161
62- // If not set, uses DefaultTokenizer
62+ // If not set, uses StdTokenizer with the provided delimiters and token.Caser.
6363 Tokenizer Tokenizer
6464}
6565
@@ -154,7 +154,7 @@ func (c Caps) LowerFirst(str string) string {
154154
155155// Without numbers returns the string with all numeric runes removed.
156156//
157- // It does not currently use any logic to determine if a rune (e.g. '.' )
157+ // It does not currently use any logic to determine if a rune (e.g. "." )
158158// is part of a number. This may change in the future.
159159func (c Caps ) WithoutNumbers (s string ) string {
160160 return strings .Map (func (r rune ) rune {
@@ -211,7 +211,7 @@ func (c Caps) ToLowerCamel(str string) string {
211211//
212212// caps.ToSnake("This is [an] {example}${id32}.") // this_is_an_example_id_32
213213func (c Caps ) ToSnake (str string ) string {
214- return c .ToDelimited (str , '_' , true )
214+ return c .ToDelimited (str , "_" , true )
215215}
216216
217217// ToScreamingSnake transforms the case of str into Screaming Snake Case (e.g.
@@ -220,15 +220,15 @@ func (c Caps) ToSnake(str string) string {
220220//
221221// caps.ToScreamingSnake("This is [an] {example}${id32}.") // THIS_IS_AN_EXAMPLE_ID_32
222222func (c Caps ) ToScreamingSnake (str string ) string {
223- return ToDelimited (str , '_' , false )
223+ return ToDelimited (str , "_" , false )
224224}
225225
226226// ToKebab transforms the case of str into Lower Kebab Case (e.g. an-example-string) using
227227// either the provided Converter or the DefaultConverter otherwise.
228228//
229229// caps.ToKebab("This is [an] {example}${id32}.") // this-is-an-example-id-32
230230func (c Caps ) ToKebab (str string ) string {
231- return ToDelimited (str , '-' , true )
231+ return ToDelimited (str , "-" , true )
232232}
233233
234234// ToScreamingKebab transforms the case of str into Screaming Kebab Snake (e.g.
@@ -237,15 +237,15 @@ func (c Caps) ToKebab(str string) string {
237237//
238238// caps.ToScreamingKebab("This is [an] {example}${id32}.") // THIS-IS-AN-EXAMPLE-ID-32
239239func (c Caps ) ToScreamingKebab (str string ) string {
240- return ToDelimited (str , '-' , false )
240+ return ToDelimited (str , "-" , false )
241241}
242242
243243// ToDotNotation transforms the case of str into Lower Dot Notation Case (e.g. an.example.string) using
244244// either the provided Converter or the DefaultConverter otherwise.
245245//
246246// caps.ToDotNotation("This is [an] {example}${id32}.") // this.is.an.example.id.32
247247func (c Caps ) ToDotNotation (str string ) string {
248- return ToDelimited (str , '.' , true )
248+ return ToDelimited (str , "." , true )
249249}
250250
251251// ToScreamingDotNotation transforms the case of str into Screaming Kebab Case (e.g.
@@ -254,7 +254,7 @@ func (c Caps) ToDotNotation(str string) string {
254254//
255255// caps.ToScreamingDotNotation("This is [an] {example}${id32}.") // THIS.IS.AN.EXAMPLE.ID.32
256256func (c Caps ) ToScreamingDotNotation (str string ) string {
257- return ToDelimited (str , '.' , false )
257+ return ToDelimited (str , "." , false )
258258}
259259
260260// ToTitle transforms the case of str into Title Case (e.g. An Example String) using
@@ -281,10 +281,10 @@ func (c Caps) ToTitle(str string) string {
281281//
282282// # Example
283283//
284- // caps.ToDelimited("This is [an] {example}${id}.#32", '.' , true) // this.is.an.example.id.32
285- // caps.ToDelimited("This is [an] {example}${id}.break32", '.' , false) // THIS.IS.AN.EXAMPLE.ID.BREAK.32
286- // caps.ToDelimited("This is [an] {example}${id}.v32", '.' , true, caps.Opts{AllowedSymbols: "$"}) // this.is.an.example.$.id.v32
287- func (c Caps ) ToDelimited (str string , delimiter rune , lowercase bool ) string {
284+ // caps.ToDelimited("This is [an] {example}${id}.#32", "." , true) // this.is.an.example.id.32
285+ // caps.ToDelimited("This is [an] {example}${id}.break32", "." , false) // THIS.IS.AN.EXAMPLE.ID.BREAK.32
286+ // caps.ToDelimited("This is [an] {example}${id}.v32", "." , true, caps.Opts{AllowedSymbols: "$"}) // this.is.an.example.$.id.v32
287+ func (c Caps ) ToDelimited (str string , delimiter string , lowercase bool ) string {
288288 var style Style
289289 var replacementStyle ReplaceStyle
290290 if lowercase {
@@ -298,7 +298,7 @@ func (c Caps) ToDelimited(str string, delimiter rune, lowercase bool) string {
298298 Style : style ,
299299 ReplaceStyle : replacementStyle ,
300300 Input : str ,
301- Join : string ( delimiter ) ,
301+ Join : delimiter ,
302302 AllowedSymbols : c .allowedSymbols ,
303303 NumberRules : c .numberRules ,
304304 })
0 commit comments