{"id":17130703,"url":"https://github.com/jechol/either","last_synced_at":"2025-03-24T04:46:07.371Z","repository":{"id":61681704,"uuid":"553928239","full_name":"jechol/either","owner":"jechol","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-15T05:42:57.000Z","size":83,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T23:39:15.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/jechol.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}},"created_at":"2022-10-19T01:40:34.000Z","updated_at":"2025-01-31T23:07:52.000Z","dependencies_parsed_at":"2022-10-20T04:15:37.237Z","dependency_job_id":null,"html_url":"https://github.com/jechol/either","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Feither","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Feither/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Feither/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jechol%2Feither/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jechol","download_url":"https://codeload.github.com/jechol/either/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245212176,"owners_count":20578440,"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":[],"created_at":"2024-10-14T19:13:00.512Z","updated_at":"2025-03-24T04:46:07.345Z","avatar_url":"https://github.com/jechol.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Either\n\n[![test](https://github.com/jechol/either/actions/workflows/test.yml/badge.svg)](https://github.com/jechol/either/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/jechol/either/badge.svg?branch=main)](https://coveralls.io/github/jechol/either?branch=main)\n[![Hex.pm](https://img.shields.io/hexpm/v/either)](https://hex.pm/packages/either)\n[![GitHub](https://img.shields.io/github/license/jechol/either)](https://github.com/jechol/either/blob/main/LICENSE)\n\n`Either` is helpers to handle `:ok`, `{:ok, value}`, `:error` and `{:error, reason}` in consistent way.\n\nThis library is copied from `Reather.Either` from [SeokminHong/reather-lite](https://github.com/SeokminHong/reather-lite).\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:either, \"~\u003e 0.1.1\"}\n  ]\nend\n```\n\n## Usage\n\n### `Either.new`\n\nConvert a value into `ok` or `error` tuple. The result is a tuple having\nan `:ok` or `:error` atom for the first element, and a value for the second\nelement.\n\n### `Either.error`\n\nMake an error tuple from a value.\n\n### `Either.map`\n\n`map` a function to an either tuple.\nThe given function will be applied lazily\nwhen the either is an `ok` tuple.\n\n### `Either.traverse`\n\nTransform a list of eithers to an either of a list.\nIf any of the eithers is `error`, the result is `error`.\n\n```elixir\niex\u003e [{:ok, 1}, {:ok, 2}] |\u003e Either.traverse()\n{:ok, [1, 2]}\niex\u003e [{:ok, 1}, {:error, \"error!\"}, {:ok, 2}]\n...\u003e |\u003e Either.traverse()\n{:error, \"error!\"}\n```\n\n## LICENSE\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjechol%2Feither","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjechol%2Feither","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjechol%2Feither/lists"}