{"id":20784879,"url":"https://github.com/emad-elsaid/types","last_synced_at":"2025-05-05T03:23:33.489Z","repository":{"id":48956553,"uuid":"117746315","full_name":"emad-elsaid/types","owner":"emad-elsaid","description":"Go Package provides a generic data types similar to that of Ruby","archived":false,"fork":false,"pushed_at":"2024-03-24T18:29:19.000Z","size":42,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T21:41:28.593Z","etag":null,"topics":["array","generics","golang","ruby"],"latest_commit_sha":null,"homepage":null,"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/emad-elsaid.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}},"created_at":"2018-01-16T21:47:05.000Z","updated_at":"2024-07-04T09:19:38.000Z","dependencies_parsed_at":"2024-02-22T19:50:53.091Z","dependency_job_id":"8f12573c-fa09-42f7-b846-e1de1a745e78","html_url":"https://github.com/emad-elsaid/types","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Ftypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Ftypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Ftypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emad-elsaid%2Ftypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emad-elsaid","download_url":"https://codeload.github.com/emad-elsaid/types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252430580,"owners_count":21746680,"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":["array","generics","golang","ruby"],"created_at":"2024-11-17T14:34:14.314Z","updated_at":"2025-05-05T03:23:33.467Z","avatar_url":"https://github.com/emad-elsaid.png","language":"Go","readme":"# Types\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/emad-elsaid/types)](https://goreportcard.com/report/github.com/emad-elsaid/types)\n[![GoDoc](https://godoc.org/github.com/emad-elsaid/types?status.svg)](https://godoc.org/github.com/emad-elsaid/types)\n[![codecov](https://codecov.io/gh/emad-elsaid/types/branch/master/graph/badge.svg)](https://codecov.io/gh/emad-elsaid/types)\n\nGo implementation for generic types, imitating Ruby types\n\n# Data structures\n\n## Slice\n\nA slice of `comparable` type that can hold any value\n\n### Example\n\n```go\nfunc ExampleSlice() {\n\ta := Slice[int]{1, 2, 3, 4, 5, 6}\n\n\t// multiply every element by 100\n\ta = a.Map(func(e int) int {\n\t\treturn e * 100\n\t})\n\n\t// select any element \u003c= 300\n\ta = a.KeepIf(func(e int) bool {\n\t\treturn e \u003c= 300\n\t})\n\n\tfmt.Print(a)\n\n\t// Output: [100 200 300]\n}\n```\n\n### Slice Methods available:\n\n```go\nfunc (a Slice[T]) All(block func(T) bool) bool\nfunc (a Slice[T]) Any(block func(T) bool) bool\nfunc (a Slice[T]) At(index int) *T\nfunc (a Slice[T]) CountBy(block func(T) bool) (count int)\nfunc (a Slice[T]) CountElement(element T) (count int)\nfunc (a Slice[T]) Cycle(count int, block func(T))\nfunc (a Slice[T]) Delete(element T) Slice[T]\nfunc (a Slice[T]) DeleteAt(index int) Slice[T]\nfunc (a Slice[T]) DeleteIf(block func(T) bool) Slice[T]\nfunc (a Slice[T]) Drop(count int) Slice[T]\nfunc (a Slice[T]) Each(block func(T))\nfunc (a Slice[T]) EachIndex(block func(int))\nfunc (a Slice[T]) Fetch(index int, defaultValue T) T\nfunc (a Slice[T]) Fill(element T, start int, length int) Slice[T]\nfunc (a Slice[T]) FillWith(start int, length int, block func(int) T) Slice[T]\nfunc (a Slice[T]) First() *T\nfunc (a Slice[T]) Firsts(count int) Slice[T]\nfunc (a Slice[T]) Include(element T) bool\nfunc (a Slice[T]) Index(element T) int\nfunc (a Slice[T]) IndexBy(block func(T) bool) int\nfunc (a Slice[T]) Insert(index int, elements ...T) Slice[T]\nfunc (a Slice[T]) IsEmpty() bool\nfunc (a Slice[T]) IsEq(other Slice[T]) bool\nfunc (a Slice[T]) KeepIf(block func(T) bool) Slice[T]\nfunc (a Slice[T]) Last() *T\nfunc (a Slice[T]) Lasts(count int) Slice[T]\nfunc (a Slice[T]) Len() int\nfunc (a Slice[T]) Map(block func(T) T) Slice[T]\nfunc (a Slice[T]) Max(block func(T) int) T\nfunc (a Slice[T]) Min(block func(T) int) T\nfunc (a Slice[T]) Pop() (Slice[T], T)\nfunc (a Slice[T]) Push(element T) Slice[T]\nfunc (a Slice[T]) Reduce(block func(T) bool) Slice[T]\nfunc (a Slice[T]) Reverse() Slice[T]\nfunc (a Slice[T]) Select(block func(T) bool) Slice[T]\nfunc (a Slice[T]) SelectUntil(block func(T) bool) Slice[T]\nfunc (a Slice[T]) Shift() (T, Slice[T])\nfunc (a Slice[T]) Shuffle() Slice[T]\nfunc (a Slice[T]) Unshift(element T) Slice[T]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Ftypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femad-elsaid%2Ftypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femad-elsaid%2Ftypes/lists"}