{"id":16309120,"url":"https://github.com/susisu/loquat","last_synced_at":"2025-03-16T14:30:40.084Z","repository":{"id":68725225,"uuid":"71680218","full_name":"susisu/loquat","owner":"susisu","description":"Monadic parser combinators for JavaScript / TypeScript","archived":false,"fork":false,"pushed_at":"2020-11-06T12:33:46.000Z","size":1704,"stargazers_count":49,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-27T10:08:09.195Z","etag":null,"topics":["javascript","parser-combinators","parsing","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/susisu.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":"2016-10-23T03:47:48.000Z","updated_at":"2024-05-31T15:27:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3fdd328-66a7-4042-a8a6-e47ea4b2b60a","html_url":"https://github.com/susisu/loquat","commit_stats":{"total_commits":1089,"total_committers":2,"mean_commits":544.5,"dds":"0.0018365472910927272","last_synced_commit":"ba563fd109b6099a528964c278d86a8e8b8f8592"},"previous_names":["susisu/loquat2"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susisu%2Floquat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susisu%2Floquat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susisu%2Floquat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/susisu%2Floquat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/susisu","download_url":"https://codeload.github.com/susisu/loquat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243816619,"owners_count":20352398,"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":["javascript","parser-combinators","parsing","typescript"],"created_at":"2024-10-10T21:19:42.031Z","updated_at":"2025-03-16T14:30:39.574Z","avatar_url":"https://github.com/susisu.png","language":"JavaScript","readme":"# loquat\n[![CI](https://github.com/susisu/loquat/workflows/CI/badge.svg)](https://github.com/susisu/loquat/actions?query=workflow%3ACI)\n\nMonadic parser combinators for JavScript, inspired by [Parsec](https://github.com/haskell/parsec).\n\n``` javascript\nimport * as lq from \"@loquat/simple\";\n\nconst nat = lq.digit.manyChars1().map(str =\u003e parseInt(str, 10));\nconst op = lq.choice([\n  lq.char(\"+\").return((a, b) =\u003e a + b),\n  lq.char(\"-\").return((a, b) =\u003e a - b),\n]);\nconst expr =\n  nat.bind(a =\u003e\n    op.bind(f =\u003e\n      nat.map(b =\u003e\n        f(a, b)\n      )\n    )\n  );\n\nconst res = expr.parse(\"\", \"14+28\"); // { success: true, value: 42 }\n```\n\n## Packages\nIf you are not familiar with loquat, or you are using TypeScript, `@loquat/simple` is recommended.\n\n- [simple](https://github.com/susisu/loquat/tree/master/packages/simple)\n\nFor a more flexible and extensible framework, use `@loquat/framework`.\n\n- [framework](https://github.com/susisu/loquat/tree/master/packages/framework)\n\nThe core features and extensions are provided as separate packages.\n\n- [core](https://github.com/susisu/loquat/tree/master/packages/core)\n- [prim](https://github.com/susisu/loquat/tree/master/packages/prim)\n- [char](https://github.com/susisu/loquat/tree/master/packages/char)\n- [combinators](https://github.com/susisu/loquat/tree/master/packages/combinators)\n- [monad](https://github.com/susisu/loquat/tree/master/packages/monad)\n- [expr](https://github.com/susisu/loquat/tree/master/packages/expr)\n- [qo](https://github.com/susisu/loquat/tree/master/packages/qo)\n- [token](https://github.com/susisu/loquat/tree/master/packages/token)\n\nFor extension development, a [chai](https://www.chaijs.com) plugin and some test helpers are available.\n\n- [testutil](https://github.com/susisu/loquat/tree/master/packages/testutil)\n\n## License\n```\nCopyright 2019 Susisu\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusisu%2Floquat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsusisu%2Floquat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusisu%2Floquat/lists"}