mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
14 lines
249 B
Go
14 lines
249 B
Go
package user
|
|
|
|
import "reflect"
|
|
|
|
func mapTo[From, To any](from []From) []To {
|
|
to := make([]To, 0, len(from))
|
|
|
|
for _, from := range from {
|
|
to = append(to, reflect.ValueOf(from).Convert(reflect.TypeOf(to).Elem()).Interface().(To))
|
|
}
|
|
|
|
return to
|
|
}
|