mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 10:36:43 +00:00
- Add `Chunk` to split slices into groups of size n. - Add `ContainsBy` for predicate-based containment checks. - Add `UniqueBy` to deduplicate slices by key selector. - Add `ParallelMap` for concurrent mapping with context and error handling. - Add `maps.Keys` and `maps.Values` helpers for extracting map keys/values. - Update README and docs for new features. - Refactor `Contains` to use `slices.Contains`.
293 B
293 B
| title | date |
|---|---|
| Chunk | 2025-09-01T00:00:00-00:00 |
Chunk splits a slice into groups of size n. The last chunk may be smaller.
package main
import (
"fmt"
u "github.com/rjNemo/underscore"
)
func main() {
fmt.Println(u.Chunk([]int{1,2,3,4,5}, 2)) // [[1 2] [3 4] [5]]
}