If you've ever switched between JavaScript and Go in the same week, you've felt this. You're three lines into a Go function, you reach for .filter() , and then you remember: right, for loop. Or write a one-off helper for the third time this month.
go-js-array-methods provides Filter, Map, Reduce, Includes, At, Slice, Splice, Push, Pop — 30+ methods named exactly like their JS counterparts. Generics-powered, immutable by default, chainable if you want it.
Repo: github.com/bube054/go-js-array-methods
Quick taste
import "github.com/bube054/go-js-array-methods/v2/array"
nums := [] int { 1 , 2 , 3 , 4 , 5 }
even := array . Filter ( nums , func ( n , _ int , _ [] int ) bool { return n % 2 == 0 }) doubled := array . Map ( even , func ( n , _ int , _ [] int ) int { return n * 2 }) // [4, 8]
Enter fullscreen mode
Exit fullscreen mode
Or chainable, if you prefer that style:
arr := array . Array [ int ]{ 1 , 2 , 3 , 4 , 5 }
result := arr . Filter ( func ( n , _ int , _ [] int ) bool { return n % 2 == 0 }) .…