{"id":15691286,"url":"https://github.com/anandchowdhary/text-filter-parser","last_synced_at":"2026-01-19T08:02:12.671Z","repository":{"id":35076547,"uuid":"203740843","full_name":"AnandChowdhary/text-filter-parser","owner":"AnandChowdhary","description":"🌪️ Parse query filter rules given in plain text","archived":false,"fork":false,"pushed_at":"2024-06-18T02:25:15.000Z","size":270,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T18:58:20.082Z","etag":null,"topics":["mysql","nodejs","query","query-language","typescript"],"latest_commit_sha":null,"homepage":"https://anandchowdhary.github.io/text-filter-parser/","language":"TypeScript","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/AnandChowdhary.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-22T07:41:21.000Z","updated_at":"2021-03-26T08:50:16.000Z","dependencies_parsed_at":"2024-10-23T23:07:22.783Z","dependency_job_id":"80736b4d-3e3a-4592-ba50-ebe16831e3fa","html_url":"https://github.com/AnandChowdhary/text-filter-parser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnandChowdhary/text-filter-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Ftext-filter-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Ftext-filter-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Ftext-filter-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Ftext-filter-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnandChowdhary","download_url":"https://codeload.github.com/AnandChowdhary/text-filter-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnandChowdhary%2Ftext-filter-parser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28563226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mysql","nodejs","query","query-language","typescript"],"created_at":"2024-10-03T18:20:54.641Z","updated_at":"2026-01-19T08:02:12.652Z","avatar_url":"https://github.com/AnandChowdhary.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌪️ Text Filter Parser\n\n[![NPM](https://img.shields.io/npm/v/text-filter-parser.svg)](https://www.npmjs.com/package/text-filter-parser)\n[![Build](https://img.shields.io/travis/AnandChowdhary/text-filter-parser.svg)](https://travis-ci.org/AnandChowdhary/text-filter-parser)\n[![Coveralls](https://img.shields.io/coveralls/github/AnandChowdhary/text-filter-parser.svg)](https://coveralls.io/github/AnandChowdhary/text-filter-parser)\n![Type definitions](https://img.shields.io/npm/types/text-filter-parser.svg?color=brightgreen)\n[![GitHub](https://img.shields.io/github/license/anandchowdhary/text-filter-parser.svg)](https://github.com/AnandChowdhary/text-filter-parser/blob/master/LICENSE)\n![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/AnandChowdhary/text-filter-parser.svg)\n\nA utility to parse query filter rules given in plain text and get a structured array.\n\n## ⭐ How it works\n\nIf you have a database view in your app, you might want to give users the option to filter based on a text input. For example, `hello=world` becomes:\n\n```json\n[\n  {\n    \"key\": \"hello\",\n    \"condition\": \"is\",\n    \"value\": \"world\"\n  }\n]\n```\n\nYou can then translate this into a query or use one of built-in functions like `toSQL()`.\n\n## 💻 Usage\n\nAdd fraud to your project with NPM:\n\n```bash\nnpm install text-filter-parser\n```\n\nAdd it to your project:\n\n```js\nconst Parser = require(\"text-filter-parser\");\n```\n\nCreate an object and use a method to get your desired output.\n\n```js\nconst result = new Parser(\"id \u003e 2, name ew nand\")\nconst json = result.toJSON();\nconsole.log(json);\n/*\n[\n  {\n    key\": \"id\",\n    condition\": \"is greater than\",\n    value: 2\n  },\n  {\n    key\": \"name\",\n    condition\": \"ends with\",\n    value: \"nand\"\n  }\n]\n*/\n```\n\nYou can also generate the `WHERE` clause of an SQL query:\n\n```js\nconst result = new Parser(\"id \u003e 2, name ew nand\")\nconst sql = result.toSQL();\nconsole.log(\"SELECT * FROM users WHERE \" + sql);\n/*\nSELECT * FROM users WHERE `id` \u003e 2 AND `name` = \"%nand\"\n*/\n```\n\n### Operators\n\n| Operator | Condition |\n| -------- | --------- |\n| = | `\"is\"` |\n| != | `\"is not\"` |\n| \u003e | `\"is greater than\"` |\n| \u003c | `\"is less than\"` |\n| \u003e= | `\"is greater than or equal to\"` |\n| \u003c= | `\"is less than or equal to\"` |\n| sw | `\"starts with\"` |\n| ew | `\"ends with\"` |\n| * | `\"includes\"` |\n\n## 📝 License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanandchowdhary%2Ftext-filter-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanandchowdhary%2Ftext-filter-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanandchowdhary%2Ftext-filter-parser/lists"}