Some checks are pending
Docs Deploy / build_and_deploy (push) Waiting to run
Generate Docs / cli (push) Waiting to run
Generate Config Doc / cli (push) Waiting to run
Go formatting / go-formatting (push) Waiting to run
Check links / markdown-link-check (push) Waiting to run
Integration / pre-test (push) Waiting to run
Integration / test on (push) Blocked by required conditions
Integration / status (push) Blocked by required conditions
Lint / Lint Go code (push) Waiting to run
Test / test (ubuntu-latest) (push) Waiting to run
37 lines
783 B
Go
37 lines
783 B
Go
package xstrcase
|
|
|
|
import (
|
|
"strings"
|
|
|
|
protogenerator "github.com/cosmos/gogoproto/protoc-gen-gogo/generator"
|
|
"github.com/iancoleman/strcase"
|
|
|
|
"github.com/ignite/cli/v29/ignite/pkg/xstrings"
|
|
)
|
|
|
|
// UpperCamel returns the name with upper camel and no special character.
|
|
func UpperCamel(name string) string {
|
|
return protogenerator.CamelCase(strcase.ToSnake(name))
|
|
}
|
|
|
|
// Lowercase returns the name with lower case and no special character.
|
|
func Lowercase(name string) string {
|
|
return strings.ToLower(
|
|
strings.ReplaceAll(
|
|
xstrings.NoDash(name),
|
|
"_",
|
|
"",
|
|
),
|
|
)
|
|
}
|
|
|
|
// Uppercase returns the name with upper case and no special character.
|
|
func Uppercase(name string) string {
|
|
return strings.ToUpper(
|
|
strings.ReplaceAll(
|
|
xstrings.NoDash(name),
|
|
"_",
|
|
"",
|
|
),
|
|
)
|
|
}
|