{"id":16389443,"url":"https://github.com/mnishiguchi/bit_flagger","last_synced_at":"2025-02-22T16:14:55.760Z","repository":{"id":57479736,"uuid":"402882471","full_name":"mnishiguchi/bit_flagger","owner":"mnishiguchi","description":"Manipulate bit flags in Elixir","archived":false,"fork":false,"pushed_at":"2021-09-05T00:46:01.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T05:45:39.990Z","etag":null,"topics":["bit-flag","bitflag","bitflags","elixir","elixir-lang","elixir-programming-language"],"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/mnishiguchi.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":"2021-09-03T19:49:00.000Z","updated_at":"2021-09-05T00:46:04.000Z","dependencies_parsed_at":"2022-09-26T17:41:29.358Z","dependency_job_id":null,"html_url":"https://github.com/mnishiguchi/bit_flagger","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fbit_flagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fbit_flagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fbit_flagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fbit_flagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnishiguchi","download_url":"https://codeload.github.com/mnishiguchi/bit_flagger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240199243,"owners_count":19763825,"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":["bit-flag","bitflag","bitflags","elixir","elixir-lang","elixir-programming-language"],"created_at":"2024-10-11T04:33:00.519Z","updated_at":"2025-02-22T16:14:55.723Z","avatar_url":"https://github.com/mnishiguchi.png","language":"Elixir","readme":"# BitFlagger\n\n[![Hex version](https://img.shields.io/hexpm/v/bit_flagger.svg 'Hex version')](https://hex.pm/packages/bit_flagger)\n[![API docs](https://img.shields.io/hexpm/v/bit_flagger.svg?label=docs 'API docs')](https://hexdocs.pm/bit_flagger)\n[![CI](https://github.com/mnishiguchi/bit_flagger/actions/workflows/ci.yml/badge.svg)](https://github.com/mnishiguchi/bit_flagger/actions/workflows/ci.yml)\n\nManipulate bit flags in Elixir.\n\n## Usage\n\n```elixir\n# Let's say we want to remember certain days of week as a single integer\niex\u003e days_of_week = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]\n\n# The number of bit flags\niex\u003e size = 7\n\n# All the days of the week are 127, no day of the week is the value 0\niex\u003e state = 0b0000000\n0\n\niex\u003e BitFlagger.parse(state, size)\n[false, false, false, false, false, false, false]\n\n# Turn on the flags at index 1 (Monday) and 3 (Wednesday)\niex\u003e state = state |\u003e BitFlagger.on(1) |\u003e BitFlagger.on(3)\n10\n\niex\u003e BitFlagger.parse(state, size)\n[false, true, false, true, false, false, false]\n\n# Turn off the flag at index 1 (Monday)\niex\u003e state = BitFlagger.off(state, 1)\n8\n\niex\u003e BitFlagger.parse(state, size)\n[false, false, false, true, false, false, false]\n\n# We can easily make it human readable\niex\u003e Enum.zip(days_of_week, BitFlagger.parse(state, size))\n[\n  sunday: false,\n  monday: false,\n  tuesday: false,\n  wednesday: true,\n  thursday: false,\n  friday: false,\n  saturday: false\n]\n```\n\n## Installation\n\nAdd `bit_flagger` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:bit_flagger, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be found at [https://hexdocs.pm/bit_flagger](https://hexdocs.pm/bit_flagger).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Fbit_flagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnishiguchi%2Fbit_flagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Fbit_flagger/lists"}