lo icon indicating copy to clipboard operation
lo copied to clipboard

💥 A Lodash-style Go library based on Go 1.18+ Generics (map, filter, contains, find...)

Results 291 lo issues
Sort by recently updated
recently updated
newest added

I suppose these functions are quite useful. Also add a GCD math helper.

Sometimes in business code, it's not necessary to return Right. I think it's a waste of performance. If necessary, you can swap the positions of list1 and list2. Then, I...

Use index to avoid additional copy of elements in collection. Here are the comparison results of the benchmark(time consumption reduced by 91%, will reduce more if T is more complex.):...

Is there anyway to build a slice like `vector(n, -1)` in C++. length is n and fill it with -1. I use `lo.Times(n, func(int) float64 { return -1 })` or...

It would be useful to have a function that filters slice elements by type `T` and converted to slice `[]T`. This helps to skip type assertion after filtering, example: ```go...

Is there a function similar to `Nth` that returns `Empty` if the index is out of bounds (kind of like `FromPtr` for a pointer)?

In the same vein as lo.Must, add a lo.First that simply returns the first argument from a list of arguments. > Why? Mostly so you can do ``` foo(lo.First(bar())) ```...

https://pkg.go.dev/github.com/samber/lo#BufferWithTimeout I'm using BufferWithTimeout, and found that it makes graceful shutdown/cleanups difficult, since I can't use a `select` to select on the channel and also wait for a context cancelation....

Replace reflect operations with unsafe memory operations and add corresponding benchmark. Here are the comparison results of the benchmark(time consumption reduced by **97%**): ``` name old time/op new time/op delta...

Call: `HelperFunc([]string{"a", "a"}, "b", 8)` Result: `[]string{"a", "a", "b", "b", "b", "b", "b", "b"}` Call: `HelperFunc([]string{"a", "a", "a", "a", "a", "a", "a", "a"}, "b", 8)` Result: `[]string{"a", "a", "a", "a",...