Skip to content

Commit

Permalink
renamed conversion util funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
ungerik committed Jul 2, 2024
1 parent d3679a7 commit 3ecb673
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,53 @@ import (
"os"
)

// FilesToURLs returns the URLs of a slice of Files.
func FilesToURLs(files []File) []string {
// FileURLs returns the URLs of the passed files
func FileURLs(files []File) []string {
fileURLs := make([]string, len(files))
for i, file := range files {
fileURLs[i] = file.URL()
}
return fileURLs
}

// FilesToPaths returns the FileSystem specific paths of a slice of Files.
func FilesToPaths(files []File) []string {
// FilePaths returns the FileSystem specific paths the passed files
func FilePaths(files []File) []string {
paths := make([]string, len(files))
for i, file := range files {
paths[i] = file.Path()
}
return paths
}

// FilesToNames returns a string slice with the names pars from the files
func FilesToNames(files []File) []string {
// FileNames returns the names of the passed files
func FileNames[T FileReader](files []T) []string {
names := make([]string, len(files))
for i, file := range files {
names[i] = file.Name()
}
return names
}

// FilesToFileReaders converts a slice of File to a slice of FileReader
func FilesToFileReaders(files []File) []FileReader {
// FilesAsFileReaders converts a slice of File to a slice of FileReader
func FilesAsFileReaders(files []File) []FileReader {
fileReaders := make([]FileReader, len(files))
for i, file := range files {
fileReaders[i] = file
}
return fileReaders
}

// StringsToFiles returns Files for the given fileURIs.
func StringsToFiles(fileURIs []string) []File {
// FilesFromStrings returns Files for the given fileURIs.
func FilesFromStrings(fileURIs []string) []File {
files := make([]File, len(fileURIs))
for i := range fileURIs {
files[i] = File(fileURIs[i])
}
return files
}

// StringsToFileReaders returns FileReaders for the given fileURIs.
func StringsToFileReaders(fileURIs []string) []FileReader {
// FileReadersFromStrings returns FileReaders for the given fileURIs.
func FileReadersFromStrings(fileURIs []string) []FileReader {
fileReaders := make([]FileReader, len(fileURIs))
for i := range fileURIs {
fileReaders[i] = File(fileURIs[i])
Expand Down

0 comments on commit 3ecb673

Please sign in to comment.