Path: blob/main/vendor/github.com/sagikazarmark/locafero/helpers.go
2875 views
package locafero12import "fmt"34// NameWithExtensions creates a list of names from a base name and a list of extensions.5//6// TODO: find a better name for this function.7func NameWithExtensions(baseName string, extensions ...string) []string {8var names []string910if baseName == "" {11return names12}1314for _, ext := range extensions {15if ext == "" {16continue17}1819names = append(names, fmt.Sprintf("%s.%s", baseName, ext))20}2122return names23}2425// NameWithOptionalExtensions creates a list of names from a base name and a list of extensions,26// plus it adds the base name (without any extensions) to the end of the list.27//28// TODO: find a better name for this function.29func NameWithOptionalExtensions(baseName string, extensions ...string) []string {30var names []string3132if baseName == "" {33return names34}3536names = NameWithExtensions(baseName, extensions...)37names = append(names, baseName)3839return names40}414243