aboutsummaryrefslogtreecommitdiff
path: root/misc/misc.go
diff options
context:
space:
mode:
Diffstat (limited to 'misc/misc.go')
-rw-r--r--misc/misc.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/misc.go b/misc/misc.go
index bc48486..ee0fd7a 100644
--- a/misc/misc.go
+++ b/misc/misc.go
@@ -1,8 +1,21 @@
package misc
+import "strings"
+
func FirstOrPanic[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
+
+// sliceContainsNewlines returns true if and only if the given slice contains
+// one or more strings that contains newlines.
+func SliceContainsNewlines(s []string) bool {
+ for _, v := range s {
+ if strings.Contains(v, "\n") {
+ return true
+ }
+ }
+ return false
+}