{"id":13509296,"url":"https://github.com/igas/custom_base","last_synced_at":"2025-04-15T22:22:43.453Z","repository":{"id":28288549,"uuid":"31801005","full_name":"igas/custom_base","owner":"igas","description":"Allow you to make custom base conversion in Elixir.","archived":false,"fork":false,"pushed_at":"2024-09-26T15:26:44.000Z","size":50,"stargazers_count":22,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T02:05:38.932Z","etag":null,"topics":["decoder","decoding","elixir","encoder","encoding","hacktoberfest"],"latest_commit_sha":null,"homepage":"","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/igas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["igas"]}},"created_at":"2015-03-07T04:30:40.000Z","updated_at":"2024-06-13T12:57:29.000Z","dependencies_parsed_at":"2024-05-20T02:24:02.502Z","dependency_job_id":"1b7f3a7c-d1d4-4f9f-8465-f12302c5dc03","html_url":"https://github.com/igas/custom_base","commit_stats":{"total_commits":70,"total_committers":9,"mean_commits":7.777777777777778,"dds":0.6,"last_synced_commit":"19dac503ff34024b7e4ac5ad67947254e71ce837"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igas%2Fcustom_base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igas%2Fcustom_base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igas%2Fcustom_base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igas%2Fcustom_base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igas","download_url":"https://codeload.github.com/igas/custom_base/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249162042,"owners_count":21222585,"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":["decoder","decoding","elixir","encoder","encoding","hacktoberfest"],"created_at":"2024-08-01T02:01:05.828Z","updated_at":"2025-04-15T22:22:43.433Z","avatar_url":"https://github.com/igas.png","language":"Elixir","funding_links":["https://github.com/sponsors/igas"],"categories":["Text and Numbers"],"sub_categories":[],"readme":"# CustomBase\n\n[![Test](https://github.com/igas/custom_base/workflows/Test/badge.svg)](https://github.com/igas/custom_base/actions?query=workflow%3ATest)\n[![Module Version](https://img.shields.io/hexpm/v/custom_base.svg)](https://hex.pm/packages/custom_base)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/custom_base/)\n[![Total Download](https://img.shields.io/hexpm/dt/custom_base.svg)](https://hex.pm/packages/custom_base)\n[![License](https://img.shields.io/hexpm/l/custom_base.svg)](https://github.com/igas/custom_base/blob/main/LICENSE)\n[![Last Updated](https://img.shields.io/github/last-commit/igas/custom_base.svg)](https://github.com/igas/custom_base/commits/main)\n\nCustomBase allow you to make custom base conversion in Elixir.\n\n## Installation\n\nAdd `{:custom_base, \"~\u003e 0.2\"}` to `deps` function in your `mix.exs` file.\n\nAfter you are done, run `mix deps.get` in your shell to fetch and compile CustomBase.\n\n## Examples\n\nLets make `Base12` module with conversion described below.\n\n| Value | Encoding |\n|------:|---------:|\n|      0|         0|\n|      1|         1|\n|      2|         2|\n|      3|         3|\n|      4|         4|\n|      5|         5|\n|      6|         6|\n|      7|         7|\n|      8|         8|\n|      9|         9|\n|     10|         A|\n|     11|         B|\n\nAdd macro to your module:\n\n```elixir\ndefmodule Base12 do\n  use CustomBase, '0123456789AB'\nend\n```\n\nNow your module have 2 functions `encode/1` and `decode/1`:\n\n```\niex\u003e Base12.encode(9)\n\"9\"\niex\u003e Base12.encode(10)\n\"A\"\niex\u003e Base12.encode(11)\n\"B\"\niex\u003e Base12.encode(12)\n\"10\"\niex\u003e Base12.decode(\"16\")\n18\niex\u003e Base12.decode(\"AB\")\n131\n```\n\n## Specs \u0026 Docs\n\nAll specs included by this library, if you want to provide your documentation,\nadd it after `use` call, like this:\n\n```\ndefmodule Base12 do\n  use CustomBase, '0123456789AB'\n\n  @moduledoc \"\"\"\n  Your module docs.\n  \"\"\"\n\n  @doc \"\"\"\n  Documentation for encode/1.\n  \"\"\"\n  def encode(integer)\n\n  @doc \"\"\"\n  Documentation for decode/1.\n  \"\"\"\n  def decode(binary)\n\n  @doc \"\"\"\n  Documentation for decode!/1.\n  \"\"\"\n  def decode!(binary)\nend\n```\n\n## License\n\nCopyright (c) 2015 Igor Kapkov\n\nThis library is MIT licensed. See the [LICENSE](https://github.com/igas/custom_base/blob/main/LICENSE)\nfor details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figas%2Fcustom_base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figas%2Fcustom_base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figas%2Fcustom_base/lists"}