mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Adding ReaderTo and ToReader helper functions
This commit is contained in:
parent
2cb89a523a
commit
dcea0fa5ce
1 changed files with 14 additions and 0 deletions
|
@ -64,6 +64,20 @@ func ReaderToBytes(lines io.Reader) []byte {
|
|||
return b.Bytes()
|
||||
}
|
||||
|
||||
func ReaderToString(lines io.Reader) string {
|
||||
b := new(bytes.Buffer)
|
||||
b.ReadFrom(lines)
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func StringToReader(in string) io.Reader {
|
||||
return strings.NewReader(in)
|
||||
}
|
||||
|
||||
func BytesToReader(in []byte) io.Reader {
|
||||
return bytes.NewReader(in)
|
||||
}
|
||||
|
||||
// sliceToLower goes through the source slice and lowers all values.
|
||||
func SliceToLower(s []string) []string {
|
||||
if s == nil {
|
||||
|
|
Loading…
Reference in a new issue