{"id":20250329,"url":"https://github.com/nilsmagnus/functions","last_synced_at":"2025-10-27T15:05:56.913Z","repository":{"id":37949886,"uuid":"440815536","full_name":"nilsmagnus/functions","owner":"nilsmagnus","description":"Handy collection functions for the go language","archived":false,"fork":false,"pushed_at":"2024-06-28T08:04:26.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T02:54:59.958Z","etag":null,"topics":["generics","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nilsmagnus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2021-12-22T10:13:49.000Z","updated_at":"2024-06-28T08:06:11.000Z","dependencies_parsed_at":"2025-01-14T02:42:31.151Z","dependency_job_id":"ace23543-e7c9-47ba-8c5f-d0a1c8b1b2d3","html_url":"https://github.com/nilsmagnus/functions","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsmagnus%2Ffunctions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsmagnus%2Ffunctions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsmagnus%2Ffunctions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilsmagnus%2Ffunctions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilsmagnus","download_url":"https://codeload.github.com/nilsmagnus/functions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241696877,"owners_count":20004903,"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","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":["generics","go","golang"],"created_at":"2024-11-14T09:57:57.661Z","updated_at":"2025-10-27T15:05:51.879Z","avatar_url":"https://github.com/nilsmagnus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![tests passing](https://github.com/nilsmagnus/functions/actions/workflows/go.yml/badge.svg)\n\n\n# functions to go\n\nHandy collection-functions for the `go` language. \n\nFunctions to support common collection-operations: \n\n* `map`\n* `reduce`\n* `filter`\n* `associate`,`associateby`\n* `contains`, `containsAll`\n* `first`, `last`\n* `forEach`, `forEachIndexed`\n* `distinct`\n\nComing soon: See godoc for complete documentation.\n\n## getting started\n\n    go get github.com/nilsmagnus/functions\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/nilsmagnus/functions\"\n\t\"log\"\n)\n\nfunc main() {\n\titems := []int{1, 2, 99}\n\n\tmappedItems := functions.Map(items, func(a int) string { return fmt.Sprintf(\"mapped %d\", a) })\n\n\tlog.Printf(\"Mapped items: %v\", mappedItems)\n}\n\n```\n\nRun this example on the [playground](https://go.dev/play/p/tpcenABL62q?v=gotip)\n\n\nHave a look at [functions_test.go](functions_test.go) for usage.\n\n\n### Map-function\n```go\n\nnumbers := []int{1,2,3,199}\n\nmapd := Map(numbers, func(a int) string { return fmt.Sprintf(\"%d\", a)}) \n\n// mapd =\u003e []string{\"1\", \"2\", \"3\", \"199\"}\n```\n\n### AssociateBy-function \n```go\nnumbers := []int{1,2,3,199}\n\nmapd := AssociateBy(numbers, func(t int) string {\n    return fmt.Sprintf(\"%d\", t)\n}) \n\n// =\u003e map[string]int {\"1\":1, \"2\":2, \"3\":3, \"199\": 199}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsmagnus%2Ffunctions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilsmagnus%2Ffunctions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilsmagnus%2Ffunctions/lists"}