-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from stefafafan/deprecate-go-123-functions
Deprecate methods added in Go 1.23
- Loading branch information
Showing
3 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build !go1.23 | ||
|
||
package godash | ||
|
||
import ( | ||
"github.com/samber/lo" | ||
) | ||
|
||
// Chunk receives the collection and chunks it into a slice of slices each of the given size. | ||
func Chunk[T any](collection []T, size int) [][]T { | ||
return lo.Chunk(collection, size) | ||
} | ||
|
||
// Keys returns the keys of the map as a slice. | ||
func Keys[K comparable, V any](in map[K]V) []K { | ||
return lo.Keys(in) | ||
} | ||
|
||
// Values returns the values of the map as a slice. | ||
func Values[K comparable, V any](in map[K]V) []V { | ||
return lo.Values(in) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//go:build go1.23 | ||
|
||
package godash | ||
|
||
import ( | ||
"github.com/samber/lo" | ||
) | ||
|
||
// Chunk receives the collection and chunks it into a slice of slices each of the given size. | ||
// | ||
// Deprecated: Use https://pkg.go.dev/slices#Chunk instead. | ||
func Chunk[T any](collection []T, size int) [][]T { | ||
return lo.Chunk(collection, size) | ||
} | ||
|
||
// Keys returns the keys of the map as a slice. | ||
// | ||
// Deprecated: Use https://pkg.go.dev/maps#Keys instead. | ||
func Keys[K comparable, V any](in map[K]V) []K { | ||
return lo.Keys(in) | ||
} | ||
|
||
// Values returns the values of the map as a slice. | ||
// | ||
// Deprecated: Use https://pkg.go.dev/maps#Values instead. | ||
func Values[K comparable, V any](in map[K]V) []V { | ||
return lo.Values(in) | ||
} |