{"id":17256616,"url":"https://github.com/princemaple/elixir-side-effect","last_synced_at":"2025-04-14T06:10:40.117Z","repository":{"id":57547987,"uuid":"69919397","full_name":"princemaple/elixir-side-effect","owner":"princemaple","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-05T06:44:30.000Z","size":10,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T14:49:48.815Z","etag":null,"topics":["elixir","pipe"],"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/princemaple.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":"2016-10-03T23:27:50.000Z","updated_at":"2023-12-09T11:10:44.000Z","dependencies_parsed_at":"2024-10-15T07:24:53.892Z","dependency_job_id":null,"html_url":"https://github.com/princemaple/elixir-side-effect","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.05555555555555558,"last_synced_commit":"83ad808a8ac70a29605f52da5c52f83ee4fac446"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princemaple%2Felixir-side-effect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princemaple%2Felixir-side-effect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princemaple%2Felixir-side-effect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/princemaple%2Felixir-side-effect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/princemaple","download_url":"https://codeload.github.com/princemaple/elixir-side-effect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710435,"owners_count":21149192,"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":["elixir","pipe"],"created_at":"2024-10-15T07:14:52.406Z","updated_at":"2025-04-14T06:10:40.085Z","avatar_url":"https://github.com/princemaple.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SideEffect\n\nsimple utils for making side effect calls and return the piped-in value in pipelines\n\n## Installation\n\nAdd `side_effect` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:side_effect, \"~\u003e 0.1.0\"}]\nend\n```\n\n## Why\n\nso instead of writing this:\n\n```elixir\ndef three_transformations_with_a_side_effect(x) do\n  temp =\n    x\n    |\u003e transform1()\n    |\u003e transform2()\n\n  notify_someone(temp)\n\n  transform3(temp)\nend\n```\n\nI'd just write:\n\n```elixir\ndef three_transformations_with_a_side_effect(x) do\n  x\n  |\u003e transform1()\n  |\u003e transform2()\n  |\u003e SideEffect.side_apply(\u0026notify_someone/1)\n  |\u003e transform3()\nend\n```\n\n\n## Usage\n\n```\niex\u003e 1 |\u003e SideEffect.side_call(MyApp.send_notification()) |\u003e List.wrap\n[1]\n\niex\u003e 1 |\u003e SideEffect.side_apply(\u0026MyApp.send_notification/1) |\u003e List.wrap\n[1]\n\niex\u003e 1 |\u003e SideEffect.side_apply(IO, :inspect) |\u003e List.wrap\n[1]\n\niex\u003e 1 |\u003e SideEffect.side_apply(IO, :inspect, [[base: :hex]]) |\u003e List.wrap\n[1]\n```\n\n```elixir\ndefmodule M do\n  def test(a, b, c, d), do: IO.inspect([a, b, c, d])\nend\n\nb = 2\n\nSideEffect.side_apply(b, M, :test, [1, 3, 4], 1)\n\n# prints [1,2,3,4]\n# returns 2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprincemaple%2Felixir-side-effect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprincemaple%2Felixir-side-effect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprincemaple%2Felixir-side-effect/lists"}