Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync version #1

Merged
merged 6 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ interleaved := lo.Interleave([]int{1}, []int{2, 5, 8}, []int{3, 6}, []int{4, 7,
// []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
```

[[play](https://go.dev/play/p/DDhlwrShbwe)]
[[play](https://go.dev/play/p/-RJkTLQEDVt)]

### Shuffle

Expand Down Expand Up @@ -1824,7 +1824,7 @@ str, index, ok := lo.FindLastIndexOf([]string{"foobar"}, func(i string) bool {

### FindOrElse

Search an element in a slice based on a predicate. It returns element and true if element was found.
Search an element in a slice based on a predicate. It returns the element if found or a given fallback value otherwise.

```go
str := lo.FindOrElse([]string{"a", "b", "c", "d"}, "x", func(i string) bool {
Expand Down Expand Up @@ -2048,7 +2048,7 @@ result := lo.TernaryF(false, func() string { return "a" }, func() string { retur
// "b"
```

Useful to avoid nil-pointer dereferencing in intializations, or avoid running unnecessary code
Useful to avoid nil-pointer dereferencing in initializations, or avoid running unnecessary code

```go
var s *string
Expand Down
2 changes: 1 addition & 1 deletion retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ type transactionStep[T any] struct {
onRollback func(T) T
}

// NewTransaction instanciate a new transaction.
// NewTransaction instantiate a new transaction.
func NewTransaction[T any]() *Transaction[T] {
return &Transaction[T]{
steps: []transactionStep[T]{},
Expand Down
2 changes: 1 addition & 1 deletion retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func TestDebounceBy(t *testing.T) {
mu.Unlock()
}

func TestTransation(t *testing.T) {
func TestTransaction(t *testing.T) {
is := assert.New(t)

// no error
Expand Down
2 changes: 1 addition & 1 deletion slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func Flatten[T any](collection [][]T) []T {
}

// Interleave round-robin alternating input slices and sequentially appending value at index into result
// Play: https://go.dev/play/p/DDhlwrShbwe
// Play: https://go.dev/play/p/-RJkTLQEDVt
func Interleave[T any](collections ...[]T) []T {
if len(collections) == 0 {
return []T{}
Expand Down