{"id":20015525,"url":"https://github.com/cblage/elixir-bottle","last_synced_at":"2025-10-08T00:12:20.480Z","repository":{"id":57500503,"uuid":"373191516","full_name":"cblage/elixir-bottle","owner":"cblage","description":"Bottle provides a set of custom guards that help reduce boilerplate code.","archived":false,"fork":false,"pushed_at":"2021-07-17T11:05:05.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-28T02:37:41.365Z","etag":null,"topics":["elixir","guards","macros"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/bottle","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cblage.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":"2021-06-02T14:10:57.000Z","updated_at":"2023-06-22T03:20:09.000Z","dependencies_parsed_at":"2022-08-30T20:10:06.575Z","dependency_job_id":null,"html_url":"https://github.com/cblage/elixir-bottle","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/cblage%2Felixir-bottle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblage%2Felixir-bottle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblage%2Felixir-bottle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cblage%2Felixir-bottle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cblage","download_url":"https://codeload.github.com/cblage/elixir-bottle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252408263,"owners_count":21743083,"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","guards","macros"],"created_at":"2024-11-13T07:46:27.998Z","updated_at":"2025-10-08T00:12:15.453Z","avatar_url":"https://github.com/cblage.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Bottle](https://hex.pm/packages/bottle)\n\n[![Build Status](https://www.travis-ci.com/cblage/elixir-bottle.svg?branch=main)](https://www.travis-ci.com/cblage/elixir-bottle)\n[![Coverage Status](https://coveralls.io/repos/github/cblage/elixir-bottle/badge.svg?branch=main)](https://coveralls.io/github/cblage/elixir-bottle?branch=main)\n[![Hex.pm](https://img.shields.io/hexpm/v/bottle)](https://hex.pm/packages/bottle)\n[![Documentation](https://img.shields.io/badge/hexdocs-latest-blue.svg)](https://hexdocs.pm/bottle)\n\nBottle provides a set of custom guards which help reduce a lot of boilerplate coode.\n\nYou can find the package in [hex.pm](https://hex.pm/packages/bottle) and the documentation in [hexdocs.pm](https://hexdocs.pm/bottle).\n\n## Installation\n\nThe the package can be installed from [Hex](https://hex.pm/packages/bottle),\nby adding `bottle` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:bottle, \"~\u003e 1.0\"}\n  ]\nend\n```\n\n## Usage\n\nJust put `use Bottle` on top of your module and get all the guards available in your scope:\n\n```elixir\ndefmodule MyModule do\n  use Bottle\n\n  def what_is(sub) when is_empty_binary(sub) do\n    :empty_binary\n  end\n\n  def what_is(sub) when is_non_empty_binary_shorter_than(sub, 10) do\n    :non_empty_binary_shorter_than_10_bytes\n  end\n\n  def what_is(sub) when is_non_empty_map(sub) do\n    :non_empty_map\n  end\n\n  def what_is(sub) when is_empty_map(sub) do\n    :empty_map\n  end\n\n  def what_is(sub) when is_zero(sub) do\n    :zero_integer_or_float\n  end\n\n  def what_is(sub) when is_pos_number(sub) do\n    :number_greater_than_0\n  end\n\n  def what_is(sub) when is_non_neg_integer(sub) do\n    :integer_equal_or_greater_than_0\n  end\n\n  def what_is(sub) when is_non_zero_float(sub) do\n    :non_zero_float\n  end\nend\n```\n\nYou can also import the guards selectively using `import`, ie:\n\n```elixir\nimport Bottle.Binary, only: [is_empty_binary: 1]\n```\n\n## Documentation\n\nYou can find the complete list of guards in the documentation: [https://hexdocs.pm/bottle](https://hexdocs.pm/bottle).\n\n## License\n\nBottle is available under the [BSD 3-Clause aka \"BSD New\" license](http://www.tldrlegal.com/l/BSD3)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcblage%2Felixir-bottle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcblage%2Felixir-bottle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcblage%2Felixir-bottle/lists"}