A collection of functional programming utilities for Go, inspired by underscore.js, designed to enhance developer productivity.
go-underscore is a Go utility library that brings functional programming patterns to the language, offering a set of helpful functions for working with collections like slices and maps. It aims to improve developer experience by providing familiar functional operations, such as Each, Map, and Partition, in a statically typed environment. The library is designed with a 'move fast; optimize late' philosophy, prioritizing productivity and learning over strict idiomatic Go conventions.
Go developers who are familiar with functional programming concepts from languages like JavaScript (via underscore.js) and want to apply similar patterns, such as map, filter, and reduce, to their Go code. It also targets those working on data processing tasks with slices and maps who value productivity and type safety through typed helper functions.
Developers choose go-underscore for its blend of functional programming utilities with Go's static typing, including typed variants via helpers like MakeEach and MakeMap for enhanced type safety. Its unique selling point includes parallel execution capabilities (e.g., EachP, parallel map) with worker pools for concurrent processing, offering performance optimizations not always found in similar libraries.
Helpfully Functional Go - A useful collection of Go utilities. Designed for programmer happiness.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Includes EachP and parallel map with worker pools for concurrent collection operations, as demonstrated in the README examples, enabling performance gains on large datasets.
Provides MakeEach, MakeMap, and MakePartition helpers to create typed variants, ensuring compile-time safety without losing flexibility, shown in code snippets for typed slices and maps.
Iterator functions automatically adapt to collection type, passing value/index for slices and value/key for maps, simplifying code across different data structures as explained in the Each section.
Offers familiar operations like Map, Partition, and Contains from underscore.js, reducing boilerplate for data processing with examples for both interface{} and typed usage.
The README explicitly warns the package is in 'heavy flux', leading to potential breaking changes and making it unreliable for projects needing long-term stability.
Godoc is a work in progress, and todo items like 'contains' and 'indexOf' are not implemented, hindering usability and learning for new users.
Base functions rely on interface{} types, requiring type assertions that can fail at runtime, unlike more robust type-safe alternatives or native Go code with generics.