{"id":20214783,"url":"https://github.com/malikzh/computejs","last_synced_at":"2026-06-12T09:32:10.030Z","repository":{"id":102283811,"uuid":"194279220","full_name":"malikzh/computejs","owner":"malikzh","description":"An expression calculator library for JavaScript","archived":false,"fork":false,"pushed_at":"2020-08-15T19:43:06.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-03T11:16:55.038Z","etag":null,"topics":["calculator","compute","computejs","expression","formula","function","javascript","js","lexer","library","math","parser","secure"],"latest_commit_sha":null,"homepage":"https://github.com/malikzh/computejs","language":"JavaScript","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/malikzh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-06-28T13:34:00.000Z","updated_at":"2019-07-02T03:22:58.000Z","dependencies_parsed_at":"2023-10-29T13:45:14.155Z","dependency_job_id":null,"html_url":"https://github.com/malikzh/computejs","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/malikzh/computejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malikzh%2Fcomputejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malikzh%2Fcomputejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malikzh%2Fcomputejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malikzh%2Fcomputejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/malikzh","download_url":"https://codeload.github.com/malikzh/computejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/malikzh%2Fcomputejs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34238713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["calculator","compute","computejs","expression","formula","function","javascript","js","lexer","library","math","parser","secure"],"created_at":"2024-11-14T06:18:04.892Z","updated_at":"2026-06-12T09:32:10.012Z","avatar_url":"https://github.com/malikzh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compute.js\n\nAn expression calculator for JavaScript\n\n\n## Features\n\n- Basic math operators:\n    - `+` - Addition\n    - `-` - Subtraction\n    - `*` - Multltiplication\n    - `/` - Division\n    - `^` - Power (right associative)\n    - `%` - Modulo division\n- Brackets support\n- Operators precedence support\n- Custom functions support\n- Function recursion support\n- Variables support\n- Unary operators support\n\n## Demo\n\nYou can try it [on JSFiddle](https://jsfiddle.net/malikzh/bLgsv3uz/)\n\n## How it use\n\nJust call a function:\n\n```js\nCompute(expression, functions, variables);\n```\n\n### Simple usage\n\n```js\nlet result = Compute('5 * (3 + 4) + 3');\nconsole.log(result); // displays 38\n```\n\n### Functions call\n\n```js\nlet result = Compute('10 + dist(5, dist(3, 4))', {\n\tdist: function (args) {\n  \treturn (args[0] ** 2) + (args[1] ** 2);\n  }\n });\n \nconsole.log(result); // displays 660\n```\n\n### Variables support\n\n```\nlet result = Compute('myvar ^ 2', {}, {\n\tmyvar: 32\n});\n \nconsole.log(result); // displays 1024\n```\n\n## License\n\nThis project licensed with [MIT](LICENSE) license\n\n---\n\nMade with ❤️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalikzh%2Fcomputejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalikzh%2Fcomputejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalikzh%2Fcomputejs/lists"}