Merge branch 'master' of https://github.com/samber/lo into feat-must-any

This commit is contained in:
wirekang
2022-04-22 19:29:55 +09:00
5 changed files with 101 additions and 11 deletions
+5 -5
View File
@@ -30,31 +30,31 @@ func Must1[T any](val T, err any) T {
return Must(val, err)
}
// Must2 has the same behavior than Must, but callback returns 2 variable2.
// Must2 has the same behavior than Must, but callback returns 2 variables.
func Must2[T1 any, T2 any](val1 T1, val2 T2, err any) (T1, T2) {
must(err)
return val1, val2
}
// Must3 has the same behavior than Must, but callback returns 2 variable2.
// Must3 has the same behavior than Must, but callback returns 3 variables.
func Must3[T1 any, T2 any, T3 any](val1 T1, val2 T2, val3 T3, err any) (T1, T2, T3) {
must(err)
return val1, val2, val3
}
// Must4 has the same behavior than Must, but callback returns 2 variable2.
// Must4 has the same behavior than Must, but callback returns 4 variables.
func Must4[T1 any, T2 any, T3 any, T4 any](val1 T1, val2 T2, val3 T3, val4 T4, err any) (T1, T2, T3, T4) {
must(err)
return val1, val2, val3, val4
}
// Must5 has the same behavior than Must, but callback returns 2 variable2.
// Must5 has the same behavior than Must, but callback returns 5 variables.
func Must5[T1 any, T2 any, T3 any, T4 any, T5 any](val1 T1, val2 T2, val3 T3, val4 T4, val5 T5, err any) (T1, T2, T3, T4, T5) {
must(err)
return val1, val2, val3, val4, val5
}
// Must6 has the same behavior than Must, but callback returns 2 variable2.
// Must6 has the same behavior than Must, but callback returns 6 variables.
func Must6[T1 any, T2 any, T3 any, T4 any, T5 any, T6 any](val1 T1, val2 T2, val3 T3, val4 T4, val5 T5, val6 T6, err any) (T1, T2, T3, T4, T5, T6) {
must(err)
return val1, val2, val3, val4, val5, val6