{"id":15288034,"url":"https://github.com/ympons/expreso","last_synced_at":"2025-07-25T02:35:56.235Z","repository":{"id":62429371,"uuid":"80705445","full_name":"ympons/expreso","owner":"ympons","description":":coffee: A boolean expression parser and evaluator in Elixir.","archived":false,"fork":false,"pushed_at":"2020-01-22T04:48:16.000Z","size":23,"stargazers_count":66,"open_issues_count":2,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T23:04:38.948Z","etag":null,"topics":["boolean-expression","elixir","eval","expreso","lexer","parser"],"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/ympons.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":"2017-02-02T08:09:19.000Z","updated_at":"2024-10-31T05:28:26.000Z","dependencies_parsed_at":"2022-11-01T20:05:25.398Z","dependency_job_id":null,"html_url":"https://github.com/ympons/expreso","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/ympons%2Fexpreso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ympons%2Fexpreso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ympons%2Fexpreso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ympons%2Fexpreso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ympons","download_url":"https://codeload.github.com/ympons/expreso/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670520,"owners_count":21142896,"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":["boolean-expression","elixir","eval","expreso","lexer","parser"],"created_at":"2024-09-30T15:43:53.820Z","updated_at":"2025-04-13T05:34:02.221Z","avatar_url":"https://github.com/ympons.png","language":"Elixir","readme":"# Expreso [![Build Status](https://travis-ci.org/ympons/expreso.svg?branch=master)](https://travis-ci.org/ympons/expreso) [![Hex Version](https://img.shields.io/hexpm/v/expreso.svg)](https://hex.pm/packages/expreso)\nAn Elixir library for parsing and evaluating boolean expressions\n\n## Installation\n\nFrom [Hex](https://hex.pm/packages/expreso), the package can be installed by adding it to your list of dependencies in `mix.exs`: \n\n```elixir\ndef deps do\n  [{:expreso, \"~\u003e 0.1.1\"}]\nend\n```\n\n## Usage\n\n```\nExpreso.eval(expression, variables)\n```\n\nParses and evaluates the provided expression. The variables can be supplied as a map in the `variables` parameter.\n\neg.\n```\n# Evaluate if a + 2 is between 3 and 1\niex\u003e Expreso.eval(\"a + 2 in (3, 1)\", %{\"a\" =\u003e 1})\niex\u003e {:ok, true}\n\n# Check if the key \"test\" is \"works\"\niex\u003e Expreso.eval(\"test = 'works'\", %{\"test\" =\u003e \"works\"})\niex\u003e {:ok, true}\n\n# Check if the key \"test\" is \"works\" or \"great\"\niex\u003e Expreso.eval(\"test = 'works' or test = 'great'\", %{\"test\" =\u003e \"great\"})\niex\u003e {:ok, true}\n\n# Evaluate an expression with not_in_op and sum\niex\u003e Expreso.eval(\"10 + 2 not in (3, 1)\")\niex\u003e {:ok, true}\n\n# Evaluate an expression with and_logic\niex\u003e Expreso.eval(\"a + 2 in (2, 3) and 1 + 1 \u003e= 2\", %{\"a\" =\u003e 1})\niex\u003e {:ok, true}\n\n# Evaluate an expression with string\niex\u003e Expreso.eval(\"a = 'Hello' and b != 'World' and 1 + 1 = 2\", %{\"a\" =\u003e \"Hello\", \"b\" =\u003e \"\"})\niex\u003e {:ok, true}\n\n# Evaluate an expression with an array variable\niex\u003e Expreso.eval(\"a in b\", %{\"a\" =\u003e 1, \"b\" =\u003e [2, 1]})\niex\u003e {:ok, true}\n\n# Evaluate another expression with an array variable\niex\u003e Expreso.eval(\"a not in b\", %{\"a\" =\u003e 1, \"b\" =\u003e [2, 1]})\niex\u003e {:ok, false}\n\n# Evaluate an expression using not operator\niex\u003e Expreso.eval(\"not 1 \u003e 1 + a\", %{\"a\" =\u003e 2})\niex\u003e {:ok, true}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fympons%2Fexpreso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fympons%2Fexpreso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fympons%2Fexpreso/lists"}