Lodash style go library
go get github.com/changchanghwang/godash
You can use with importing `godash``
import "github.com/changchanghwang/godash"
For now, there is only supported Slice, Array mehotds
import "github.com/changchanghwang/godash"
// without chain
godash.Map([]int{1,2,3,4,5}, func(v int) int {
return v * 2
}) // []int{2,4,6,8,10}
// with chain
godash.Chain([]int{1,2,3,4,5}).Map(func(v int) int {
return v * 2
}).Value() // []int{2,4,6,8,10}
import "github.com/changchanghwang/godash"
// without chain
godash.Head([]int{1,2,3,4,5}) // 1, true
godash.Head([]int{}) // 0, false
// with chain
godash.Chain([]int{1,2,3,4,5}).Head() // 1, true
godash.Chain([]int{}).Head() // 0, false
import "github.com/changchanghwang/godash"
// with chain
godash.Tail([]int{1,2,3,4,5}) // []int{2,3,4,5}
godash.Tail([]int{}) // []int{}
// with chain
godash.Chain([]int{1,2,3,4,5}).Tail() // []int{2,3,4,5}
godash.Chain([]int{}).Tail() // []int{}
import "github.com/changchanghwang/godash"
arr := []int{1,2,3,4,5}
godash.DeepCopySlice(arr) // []int{1,2,3,4,5}
import "github.com/changchanghwang/godash"
// without chain
arr := []int{1,2,3,4,5}
godash.Filter(arr, func(v int) bool {
return v > 3
}) // []int{4,5}
// with chain
arr := []int{1,2,3,4,5}
godash.Chain(arr).Filter(func(v int) bool {
return v > 3
}).Value() // []int{4,5}