2016-11-03 00:01:23 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
// Converts anything into a string
|
2016-11-18 17:58:00 +00:00
|
|
|
func toString(v interface{}) string {
|
2016-11-03 04:01:06 +00:00
|
|
|
return fmt.Sprint(v)
|
2016-11-03 00:01:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Contains ...
|
|
|
|
func Contains(list []string, a string) bool {
|
|
|
|
for _, b := range list {
|
|
|
|
if b == a {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// Map ...
|
|
|
|
func Map(original []string, f func(string) string) []string {
|
|
|
|
mapped := make([]string, len(original))
|
|
|
|
for index, value := range original {
|
|
|
|
mapped[index] = f(value)
|
|
|
|
}
|
|
|
|
return mapped
|
|
|
|
}
|