{"id":21278513,"url":"https://github.com/wdalmut/maybe-with-promises-3","last_synced_at":"2025-08-08T12:07:37.274Z","repository":{"id":142589606,"uuid":"146977823","full_name":"wdalmut/maybe-with-promises-3","owner":"wdalmut","description":"Maybe with promises example using Ramda and Sanctuary (only maybes)","archived":false,"fork":false,"pushed_at":"2018-09-01T16:44:03.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-04T12:16:26.147Z","etag":null,"topics":["example","maybe","ramda","sanctuary"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/wdalmut.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-01T07:29:13.000Z","updated_at":"2020-04-24T14:00:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6537a97-5785-4ea1-a554-92941d970459","html_url":"https://github.com/wdalmut/maybe-with-promises-3","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wdalmut/maybe-with-promises-3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdalmut%2Fmaybe-with-promises-3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdalmut%2Fmaybe-with-promises-3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdalmut%2Fmaybe-with-promises-3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdalmut%2Fmaybe-with-promises-3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wdalmut","download_url":"https://codeload.github.com/wdalmut/maybe-with-promises-3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wdalmut%2Fmaybe-with-promises-3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269417460,"owners_count":24413381,"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-08T02:00:09.200Z","response_time":72,"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":["example","maybe","ramda","sanctuary"],"created_at":"2024-11-21T10:14:46.373Z","updated_at":"2025-08-08T12:07:37.264Z","avatar_url":"https://github.com/wdalmut.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Use maybes with promises\n\nIn order to improve readability an example of data maybe with promises\n\n```\nconst is_confirmed = compose(equals(true), prop('confirmed'));\nget_order(id)\n  .then(ifElse(is_confirmed, Just, always(Nothing)))\n  .then(map(create_guests_for_event))\n  .then(map(send_invoice_ticket))\n  .then(prop('value'))\n  .then(console.log)\n;\n```\n\nIf the order from `get_order` is not confirmed `confirmed = false` nothing is\nexecuted.\n\n## Usage\n\n### Install dependencies\n\n```sh\nnpm install\n```\n\n### Run it\n\nExecute the data pipeline\n\n```sh\n$ node index.js 1\nGuests created! { id: '1', confirmed: true, price: 89.9 }\nInvoice sent! Promise { { id: '1', confirmed: true, price: 89.9 } }\n{ id: '1', confirmed: true, price: 89.9 }\n```\n\n_nothing to do (confirmed = false)_\n\n```sh\nnode index.js 0\nundefined\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwdalmut%2Fmaybe-with-promises-3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwdalmut%2Fmaybe-with-promises-3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwdalmut%2Fmaybe-with-promises-3/lists"}