{"id":15059714,"url":"https://github.com/kylecorbelli/typescript-maybe","last_synced_at":"2025-08-02T12:10:40.209Z","repository":{"id":57383860,"uuid":"131916675","full_name":"kylecorbelli/typescript-maybe","owner":"kylecorbelli","description":"A TypeScript Maybe Type and Module","archived":false,"fork":false,"pushed_at":"2018-05-05T18:04:48.000Z","size":53,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T12:27:12.694Z","etag":null,"topics":["elm","elm-lang","functional-programming","haskell","javascript","maybe","maybe-monad","typescript"],"latest_commit_sha":null,"homepage":"http://kylecorbelli.com/index.php/2018/05/01/typescript-maybe-type-module/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kylecorbelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-02T23:35:09.000Z","updated_at":"2019-02-11T04:33:19.000Z","dependencies_parsed_at":"2022-09-14T00:52:40.758Z","dependency_job_id":null,"html_url":"https://github.com/kylecorbelli/typescript-maybe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kylecorbelli/typescript-maybe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylecorbelli%2Ftypescript-maybe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylecorbelli%2Ftypescript-maybe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylecorbelli%2Ftypescript-maybe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylecorbelli%2Ftypescript-maybe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kylecorbelli","download_url":"https://codeload.github.com/kylecorbelli/typescript-maybe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kylecorbelli%2Ftypescript-maybe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268385921,"owners_count":24242105,"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-02T02:00:12.353Z","response_time":74,"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":["elm","elm-lang","functional-programming","haskell","javascript","maybe","maybe-monad","typescript"],"created_at":"2024-09-24T22:46:58.366Z","updated_at":"2025-08-02T12:10:40.187Z","avatar_url":"https://github.com/kylecorbelli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TypeScript Maybe Type and Module\n\n## Installation\n\n```\n$ npm install --save typescript-maybe\n```\n\n## Example Usage\n```TypeScript\nimport { Maybe, MaybeType } from 'typescript-maybe'\nimport { compose, toUpper } from 'ramda'\n\n// An example of an \"unsafe\" function that may return undefined or null:\nfunction unsafeHead\u003cT\u003e (list: ReadonlyArray\u003cT\u003e): T {\n  return list[0]\n}\n\n// Elegantly handling this unsafe function in a composition chain:\ntype UpperCaseHead = (list: ReadonlyArray\u003cstring\u003e) =\u003e Maybe\u003cstring\u003e\nconst otherUpperCaseHead: UpperCaseHead = compose(\n  Maybe.map(toUpper),\n  Maybe.of(unsafeHead),\n) as UpperCaseHead\n\n// Handling Maybe in a composition chain and returning a default value:\ntype UpperCaseHeadWithDefault = (list: ReadonlyArray\u003cstring\u003e) =\u003e string\nconst upperCaseHeadWithDefault: UpperCaseHead = compose(\n  Maybe.withDefault('Something didn’t quite go according to plan!'),\n  Maybe.map(toUpper),\n  Maybe.of(unsafeHead),\n) as UpperCaseHeadWithDefault\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylecorbelli%2Ftypescript-maybe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkylecorbelli%2Ftypescript-maybe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkylecorbelli%2Ftypescript-maybe/lists"}