GO 工具庫:Underscore.go
Underscore.go 是一個非常有幫助的 Go 實用程序集。類似 underscore.js,但是是 GO 的工具庫。
計劃功能:
-
godoc
-
contains
-
indexOf
-
worker pools
-
parallel each
-
parallel map with worker pool
-
refactor to make functions first parameter (eg Each func(func(A), []A))
-
handle maps & slices
-
all
-
any
-
none
示例:
import "un"s := []string{"a", "b", "c", "d"} fn := func(s string) string { return s + "!" } // Generic, interface based helpers m:= un.Map(s, fn) fmt.Println(m) //["a!", "b!", "c!", "d!"] // Define your own typed functions var SMap func([]string, func(string) string) []string un.MakeMap(&SMap) m := un.SMap(s, fn) fmt.Println(m) //["a!", "b!", "c!", "d!"]
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!