Corentin Clabaut
Corentin Clabaut
That's a good point! We could have `func Repeat[T any](count int, initial T) []T` ? Or maybe even `func Repeat[T any, N constraint.Integer](count N, initial T) []T`. That would make...
It feels like the same should be done for `Fill` We could have `func Fill[T any](collection []T, initial T) []T` As well as `func FillBy[T any](collection []T, predicate func(int) T)...
Shouldn't `PartitionBy` be used in that case? ```go partitions := lo.PartitionBy[int, int]([]int{1, 2, 3, 4}, func(x int) int { return x%2 }) ``` As for the reject isn't it good...
That's a good point. I think I slightly prefer the name `Either`.
Sounds good :)
Good catch @xyluet ! I doubt that's expected. I had a quick look and it looks like only `Shuffle` and `Reverse` have this issue.
It is to be able to map the either to a different type. That's why I added an helper function instead of a new method.
This helper would be helpful for cases like this: ```go type Authentification struct { mo.Either[BearerToken, BasicAuth] } func (a Authentification) GetHeader() string { mo.Map(a, func(token BearerToken) string { return BuildBearerAuthHeader(string(token))...
I can't think of a way of doing it with a single function. What about creating multiple functions `MapOption`, `MapResult`, `MapEitherX` ?
This looks nice. It's verbose, but without a language update it looks like that's the best option. I was thinking, it might be helpful to also have a function with...