{"id":21342492,"url":"https://github.com/josestg/maybe","last_synced_at":"2026-05-22T14:15:04.099Z","repository":{"id":263618600,"uuid":"890958111","full_name":"josestg/maybe","owner":"josestg","description":"Maybe is a utility for handling optional values safely and cleanly in TypeScript. Inspired by Haskell and OCaml, it provides a clear and functional approach to dealing with values that may or may not exist.","archived":false,"fork":false,"pushed_at":"2024-11-19T14:02:21.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T15:43:39.300Z","etag":null,"topics":["deno","maybe","optional-type","typescript"],"latest_commit_sha":null,"homepage":"https://jsr.io/@josestg/maybe","language":"TypeScript","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/josestg.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":"2024-11-19T13:35:45.000Z","updated_at":"2024-11-19T14:19:15.000Z","dependencies_parsed_at":"2024-11-20T01:54:50.398Z","dependency_job_id":null,"html_url":"https://github.com/josestg/maybe","commit_stats":null,"previous_names":["josestg/maybe"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fmaybe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fmaybe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fmaybe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Fmaybe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josestg","download_url":"https://codeload.github.com/josestg/maybe/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818199,"owners_count":20352629,"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":["deno","maybe","optional-type","typescript"],"created_at":"2024-11-22T01:08:52.156Z","updated_at":"2026-05-22T14:15:04.053Z","avatar_url":"https://github.com/josestg.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Maybe - Safe Optional Values for TypeScript\n\n`Maybe` is a utility for handling optional values safely and cleanly in\nTypeScript. Inspired by Haskell and OCaml, it provides a clear and functional\napproach to dealing with values that may or may not exist.\n\n## Features\n\n- **Explicit Optional Values**: Use `Some` and `None` for clarity.\n- **Functional API**: Transform and handle values with `map`, `flatMap`, and\n  `match`.\n- **Type-Safe**: Eliminate `null` and `undefined` errors.\n\n## Example\n\n```ts\nimport { map, match, none, some, unwrapOr } from \"./mod.ts\";\n\nconst value = some(42);\nconst empty = none();\n\nconsole.log(unwrapOr(value, 24)); // 42\nconsole.log(unwrapOr(empty, 24)); // 24\n\nconst squared = map(value, (v) =\u003e v ** 2); // some(1764)\nconsole.log(squared);\n\nconst message = match(value, {\n  some: (v) =\u003e `Value is ${v}`,\n  none: () =\u003e \"No value\",\n});\n\nconsole.log(message); // \"Value is 42\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Fmaybe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosestg%2Fmaybe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Fmaybe/lists"}