import files, add README & LICENSE
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package cursor
|
||||
|
||||
// DereferenceSlice takes a slice of pointers to T and returns a slice of T by
|
||||
// dereferencing each pointer and discarding any nil pointers.
|
||||
func DereferenceSlice[T any](list []*T) []T {
|
||||
var result []T
|
||||
for _, item := range list {
|
||||
if item != nil {
|
||||
result = append(result, *item)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user