github.com/go-board/x-go@v0.1.2-0.20220610024734-db1323f6cb15/xslice/map.go (about) 1 package xslice 2 3 func Map(a []interface{}, fn func(v interface{}) interface{}) []interface{} { 4 b := make([]interface{}, len(a)) 5 for i, x := range a { 6 b[i] = fn(x) 7 } 8 return b 9 }