{"id":22161966,"url":"https://github.com/codedge-llc/chimera","last_synced_at":"2025-03-24T15:41:20.436Z","repository":{"id":59150122,"uuid":"157945899","full_name":"codedge-llc/chimera","owner":"codedge-llc","description":"Dead-simple conversion between Elixir structs","archived":false,"fork":false,"pushed_at":"2020-02-10T22:29:41.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-29T20:48:19.340Z","etag":null,"topics":["elixir","hex"],"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/codedge-llc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-11-17T03:10:12.000Z","updated_at":"2020-02-10T22:29:39.000Z","dependencies_parsed_at":"2022-09-13T11:00:35.246Z","dependency_job_id":null,"html_url":"https://github.com/codedge-llc/chimera","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/codedge-llc%2Fchimera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fchimera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fchimera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedge-llc%2Fchimera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codedge-llc","download_url":"https://codeload.github.com/codedge-llc/chimera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245300829,"owners_count":20593048,"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","hex"],"created_at":"2024-12-02T04:17:46.360Z","updated_at":"2025-03-24T15:41:20.405Z","avatar_url":"https://github.com/codedge-llc.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/codedge-llc/chimera.svg?branch=master)](https://travis-ci.org/codedge-llc/chimera)\n[![Hex.pm](http://img.shields.io/hexpm/v/chimera.svg)](https://hex.pm/packages/chimera)\n[![Hex.pm](http://img.shields.io/hexpm/dt/chimera.svg)](https://hex.pm/packages/chimera)\n\n# Chimera\n\nDead-simple conversion between Elixir structs\n\n## Installation\n\nAdd chimera as a mix.exs dependency:\n\n```elixir\ndef deps do\n  [\n    {:chimera, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\n## Usage\n\nAdd `use Chimera` to your struct's module. It adds `new/1` and `new/2` functions\nthat will create a new struct from any given map, struct or keyword list.\n\n```elixir\ndefmodule User do\n  defstruct id: nil, name: nil, email: nil\n  use Chimera\nend\n\ndefmodule Profile do\n  defstruct id: nil, name: \"Person\", avatar: nil\n  use Chimera\nend\n\niex\u003e User.new(id: 1234, name: \"Person\")\n%User{id: 1234, name: \"Person\", email: nil}\n\niex\u003e user = %User{id: 1234, name: \"Person\", email: \"person@example.com\"}\niex\u003e Profile.new(user)\n%Profile{id: 1234, name: \"Person\", avatar: nil}\n```\n\n## Custom Mappings\n\nUse the optional `:map` argument to specify custom key mappings.\n`:map` is a keyword list whose keys correspond to the keys of\nthe destination struct.\n\n```elixir\niex\u003e user = %User{id: 1234, name: \"Person\", email: \"person@example.com\"}\niex\u003e Profile.new(user, map: [name: nil])\n%Profile{id: 1234, name: nil, avatar: nil}\n```\n\nSpecify a function of arity 1 that takes the source struct as\na parameter:\n\n```elixir\niex\u003e user = %User{id: 1234, name: \"Person\", email: \"person@example.com\"}\niex\u003e Profile.new(user, map: [name: fn user -\u003e String.upcase(user.email) end])\n%Profile{id: 1234, name: \"PERSON\", avatar: nil}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fchimera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodedge-llc%2Fchimera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedge-llc%2Fchimera/lists"}