issues Search Results · repo:samber/lo language:Go
Filter by
234 results
(61 ms)234 results
insamber/lo (press backspace or delete to remove)// this panics
func TestLoDivideZero(t *testing.T) {
var a []string
lo.Ternary(len(a) == 0, 1, 2/len(a))
}
// this works
func TestDivideZero(t *testing.T) {
var a []string
if len(a) == 0 {
t.Logf( ...
lwabish
- Opened 5 days ago
- #607
The documentation for the TernaryF() function nicely explains how it is a good way to avoid the nil pointer error that
occurs when you use the non-F variant like this lo.Ternary(example != nil, example.attribute, ...
peterhoward42
- 1
- Opened 7 days ago
- #605
In protobuf, I am using a map field - map string, google.protobuf.Any . After compilation is getting converted into
ma[string]*anypb.Any ,Now if I want to pass this to a template renderer engine, I am ...
vikrantest
- 1
- Opened 10 days ago
- #604
pf := lo.MFunc10(f)
pf.Partial(1).PartialR(2) // able to continuously invoking Partial, and able to Partial from the last args
https://github.com/samber/lo/pull/593
alkiller22
- Opened 11 days ago
- #603
HasIndex([]T, i int) bool // check if the index exists.
At([]T, i int) T // return the value or zero value.
AtOr([]T, i int, fallback T) T // return the value or fallback value.
renom
- 2
- Opened 12 days ago
- #602
Input:
[]string{ string 1 , string 2 , string 3 }
Output:
map[int]string{0: string 1 , 1: string 2 , 2: string 3 }
renom
- 1
- Opened 12 days ago
- #601
when use lo.Map, we never use the second param,so we do need this function to improve our code
func MapByElement[T,R any](s []T, f func(T)R) []R {
return lo.Map(s, func(t T, _ int) R {
return f(t) ...
xixiwang12138
- Opened 13 days ago
- #599
The existing lo.ForEach function makes a copy of every element as it iterates, which is problematic for arrays since
that prevents them from being modified.
Example:
type Dummy struct {
f1 string
} ...
takanuva15
- Opened 15 days ago
- #598
Suppose there are two arrays, aa and bb. I want to convert them into a map in the form of {a: b}. Currently, I need to
write the code like this:
aToB := lo.FromEntries(lo.Map(lo.Zip2(aa, bb), func(kv ...
breaking change
loggerhead
- 2
- Opened 16 days ago
- #597
Hi, the GroupByMap function is shown in the README but not in the package. I cannot find any equivalent function that
does the same thing as GroupByMap. Was it renamed?
takanuva15
- 1
- Opened 18 days ago
- #596

Learn how you can use GitHub Issues to plan and track your work.
Save views for sprints, backlogs, teams, or releases. Rank, sort, and filter issues to suit the occasion. The possibilities are endless.Learn more about GitHub IssuesProTip!
Press the /
key to activate the search input again and adjust your query.
Learn how you can use GitHub Issues to plan and track your work.
Save views for sprints, backlogs, teams, or releases. Rank, sort, and filter issues to suit the occasion. The possibilities are endless.Learn more about GitHub IssuesProTip!
Press the /
key to activate the search input again and adjust your query.