{"id":30116949,"url":"https://github.com/farbodsalimi/goulash","last_synced_at":"2025-08-10T10:33:31.313Z","repository":{"id":56800398,"uuid":"523899862","full_name":"farbodsalimi/goulash","owner":"farbodsalimi","description":"Goulash offers a variety of useful utility functions for everyday programming tasks by leveraging Go generics and keeping the functional programming paradigm in mind.","archived":false,"fork":false,"pushed_at":"2025-05-11T00:12:57.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T00:26:36.360Z","etag":null,"topics":["functional-programming","generics","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farbodsalimi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-11T23:45:31.000Z","updated_at":"2025-05-10T23:53:33.000Z","dependencies_parsed_at":"2025-05-11T00:24:05.975Z","dependency_job_id":"02c60ae3-95f5-4b9d-9ee8-ecaaeeaed1ea","html_url":"https://github.com/farbodsalimi/goulash","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/farbodsalimi/goulash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farbodsalimi%2Fgoulash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farbodsalimi%2Fgoulash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farbodsalimi%2Fgoulash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farbodsalimi%2Fgoulash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farbodsalimi","download_url":"https://codeload.github.com/farbodsalimi/goulash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farbodsalimi%2Fgoulash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269711666,"owners_count":24463199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["functional-programming","generics","golang"],"created_at":"2025-08-10T10:31:55.037Z","updated_at":"2025-08-10T10:33:31.261Z","avatar_url":"https://github.com/farbodsalimi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Goulash\n\n[![Pipeline](https://github.com/farbodsalimi/goulash/actions/workflows/go.yml/badge.svg)](https://github.com/farbodsalimi/goulash/actions/workflows/go.yml)\n[![Release](https://github.com/farbodsalimi/goulash/actions/workflows/release.yml/badge.svg)](https://github.com/farbodsalimi/goulash/actions/workflows/release.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/farbodsalimi/goulash?r)](https://goreportcard.com/report/github.com/farbodsalimi/goulash)\n[![Maintainability](https://api.codeclimate.com/v1/badges/41c658c64749a3221cf5/maintainability)](https://codeclimate.com/github/farbodsalimi/goulash/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/41c658c64749a3221cf5/test_coverage)](https://codeclimate.com/github/farbodsalimi/goulash/test_coverage)\n\nGoulash offers a variety of useful utility functions for everyday programming tasks by leveraging Go generics and keeping the functional programming paradigm in mind.\n\n**Table of Contents**\n\n- [Goulash](#goulash)\n\t- [Quick Start](#quick-start)\n\t\t- [Installation](#installation)\n\t\t- [Example](#example)\n\t- [Functions](#functions)\n\t\t- [All](#all)\n\t\t- [Any](#any)\n\t\t- [Chunk](#chunk)\n\t\t- [Compact](#compact)\n\t\t- [Concat](#concat)\n\t\t- [Contains](#contains)\n\t\t- [Difference](#difference)\n\t\t- [Filter](#filter)\n\t\t- [FlatMap](#flatmap)\n\t\t- [Fold](#fold)\n\t\t- [ForEach](#foreach)\n\t\t- [GroupBy](#groupby)\n\t\t- [Intersection](#intersection)\n\t\t- [Join](#join)\n\t\t- [Keys](#keys)\n\t\t- [Map](#map)\n\t\t- [Max](#max)\n\t\t- [Min](#min)\n\t\t- [MinMax](#minmax)\n\t\t- [Reduce](#reduce)\n\t\t- [Sort](#sort)\n\t\t- [Ternary](#ternary)\n\t\t- [Union](#union)\n\t\t- [Unique](#unique)\n\t\t- [Values](#values)\n\n## Quick Start\n\n### Installation\n\n```sh\ngo get github.com/farbodsalimi/goulash\n```\n\n### Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t__ \"github.com/farbodsalimi/goulash\"\n)\n\ntype Player struct {\n\tid    int\n\tname  string\n\tscore float64\n\tbonus float64\n}\n\nfunc main() {\n\tplayers := []Player{\n\t\t{id: 1, name: \"David\", score: 20, bonus: 15},\n\t\t{id: 2, name: \"Jessica\", score: 10, bonus: 25},\n\t\t{id: 3, name: \"Alex\", score: 40, bonus: 45},\n\t\t{id: 4, name: \"Tom\", score: 30, bonus: 25},\n\t}\n\n\ttotalScore := __.Reduce(__.Map(__.Filter(players, func(p Player) bool {\n\t\treturn len(p.name) \u003e 4\n\t}), func(p Player) float64 {\n\t\treturn p.score + p.bonus\n\t}), func(acc, newScore float64) float64 {\n\t\treturn acc + newScore\n\t}, 0)\n\n\tfmt.Println(totalScore)\n}\n```\n\n## Functions\n\n### All\n\n```go\nresult := __.All([]float64{3.1, 4.1, 5.1, 1.1, 0})\nfmt.Println(result) // false\n```\n\n### Any\n\n```go\nresult := __.Any([]float64{3.1, 4.1, 5.1, 1.1, 0})\nfmt.Println(result) // true\n```\n\n### Chunk\n\n```go\nchunks := __.Chunk([]int{1, 2, 3, 4}, 2)\nfmt.Println(chunks) // [[1 2] [3 4]]\n```\n\n### Compact\n\n```go\ncompacted := __.Compact([]int{0, 1, 2, 3})\nfmt.Println(compacted) // [1 2 3]\n```\n\n### Concat\n\n```go\nconcatenated := __.Concat([]int{1, 2, 3}, []int{4, 5, 6, 7})\nfmt.Println(concatenated) // [1 2 3 4 5 6 7]\n```\n\n### Contains\n\n```go\nresult := __.Contains([]float64{3.1, 4.1, 5.1, 1.1, -2.1}, -2.1)\nfmt.Println(result) // true\n```\n\n### Difference\n\n```go\ndiff := __.Difference([]int{1, 2, 3}, []int{1, 2})\nfmt.Println(diff) // [3]\n```\n\n### Filter\n\n```go\nfiltered := __.Filter([]int{1, 2, 3, 4, 5, 6}, func(n int) bool {\n\treturn n%2 == 1\n})\nfmt.Println(filtered) // [1 3 5]\n```\n\n### FlatMap\n\n```go\nflatten := __.FlatMap([]string{\"it's sunny in\", \"\", \"California\"}, func(s string) []string {\n\treturn strings.Split(s, \" \")\n})\nfmt.Println(flatten) // [\"it's\", \"sunny\", \"in\", \"\", \"California\"]\n```\n\n### Fold\n\n```go\nfolded := __.Fold([]int{1, 2, 3}, 0, func(a int, b int) int {\n\treturn a + b\n})\nfmt.Println(folded) // 6\n```\n\n### ForEach\n\n```go\nvar forEachResult [][]int\n__.ForEach([]int{1, 2, 3}, func(value int, args ...any) {\n\tindex := args[0].(int)\n\tforEachResult = append(forEachResult, []int{index, value})\n})\nfmt.Println(forEachResult) // [[0 1] [1 2] [2 3]]\n```\n\n### GroupBy\n\n```go\ngrouped := __.GroupBy([]float64{6.1, 4.2, 6.3}, math.Floor)\nfmt.Println(grouped) // map[4:[4.2] 6:[6.1 6.3]]\n```\n\n### Intersection\n\n```go\nintersected := __.Intersection([]string{\"a\", \"b\", \"c\", \"d\", \"e\"}, []string{\"d\", \"e\"})\nfmt.Println(intersected) // [\"d\", \"e\"]\n```\n\n### Join\n\n```go\njoined := __.Join([]uint{1, 2, 3, 4}, \", \")\nfmt.Println(joined) // 1, 2, 3, 4\n```\n\n```go\njoined := __.Join([]float64{1.1, 2.1, 3.1, 1.1, 2.1, 3.1}, \"~\")\nfmt.Println(joined) // 1.1~2.1~3.1~1.1~2.1~3.1\n```\n\n```go\njoined := __.Join([]string{\"a\", \"b\", \"c\", \"d\"}, \"*\")\nfmt.Println(joined) // a*b*c*d\n```\n\n### Keys\n\n```go\nkeys := __.Keys(map[string]string{\"key1\": \"value\", \"key2\": \"value\", \"key3\": \"value\"})\nfmt.Println(keys) // [\"key1\", \"key2\", \"key3\"\n```\n\n### Map\n\n```go\nmapped := __.Map([]int{1, 2, 3}, math.Pow10)\nfmt.Println(mapped) // [10 100 1000]\n```\n\n### Max\n\n```go\nmaxResult := __.Max([]float32{6.1, 4.2, 6.3}...)\nfmt.Println(maxResult) // 6.3\n```\n\n### Min\n\n```go\nminResult := __.Min([]float64{6.1, 4.2, 6.3}...)\nfmt.Println(minResult) // 4.2\n```\n\n### MinMax\n\n```go\nmin, max := __.MinMax([]float64{6.1, 4.2, 6.3}...)\nfmt.Println(min, max) // 4.2 6.3\n```\n\n### Reduce\n\n```go\nreduced := __.Reduce([]uint{6, 7, 8}, func(a uint, b uint) uint {\n\treturn a + b\n}, 0)\nfmt.Println(reduced) // 21\n```\n\n### Sort\n\n```go\nsorted := __.Sort([]int{6, 1, 2, 3, -1, 0, 4, 7, 5})\nfmt.Println(sorted) // [-1 0 1 2 3 4 5 6 7]\n```\n\n### Ternary\n\n```go\nresult := __.Ternary((2 + 2) == 4, \"yup\", \"nope\")\nfmt.Println(result) // yup\n```\n\n### Union\n\n```go\nunified := __.Union([][]int{{1, 2}, {2, 3, 4}, {3, 4, 5, 6, 7}}...)\nfmt.Println(unified) // [1 2 3 4 5 6 7]\n```\n\n### Unique\n\n```go\nuniq := __.Unique([]int{1, 1, 1, 1, 2, 3})\nfmt.Println(uniq) // [1 2 3]\n```\n\n### Values\n\n```go\nvalues := __.Values(map[string]string{\"key1\": \"value1\", \"key2\": \"value2\", \"key3\": \"value3\"})\nfmt.Println(values) // [\"value1\", \"value2\", \"value3\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarbodsalimi%2Fgoulash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarbodsalimi%2Fgoulash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarbodsalimi%2Fgoulash/lists"}