{"id":13981096,"url":"https://github.com/shepherdwind/simple-evaluate","last_synced_at":"2025-04-15T21:08:11.459Z","repository":{"id":43175379,"uuid":"105756521","full_name":"shepherdwind/simple-evaluate","owner":"shepherdwind","description":"A safe parse for simple js expression","archived":false,"fork":false,"pushed_at":"2022-10-19T10:19:38.000Z","size":206,"stargazers_count":61,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T21:08:01.403Z","etag":null,"topics":["evaluate-expressions","js-safe-eval"],"latest_commit_sha":null,"homepage":"https://www.yuque.com/eward/bt8ny4/bgc0gx","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/shepherdwind.png","metadata":{"files":{"readme":"README.md","changelog":"history.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":"2017-10-04T10:34:30.000Z","updated_at":"2024-06-17T18:50:51.000Z","dependencies_parsed_at":"2022-09-06T22:23:13.682Z","dependency_job_id":null,"html_url":"https://github.com/shepherdwind/simple-evaluate","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fsimple-evaluate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fsimple-evaluate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fsimple-evaluate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shepherdwind%2Fsimple-evaluate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shepherdwind","download_url":"https://codeload.github.com/shepherdwind/simple-evaluate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153944,"owners_count":21221330,"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":["evaluate-expressions","js-safe-eval"],"created_at":"2024-08-09T04:02:00.549Z","updated_at":"2025-04-15T21:08:11.441Z","avatar_url":"https://github.com/shepherdwind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Evaluate\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: http://img.shields.io/npm/v/simple-evaluate.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/simple-evaluate\n[download-image]: https://img.shields.io/npm/dm/simple-evaluate.svg?style=flat-square\n[download-url]: https://npmjs.org/package/simple-evaluate\n[travis-image]: https://img.shields.io/travis/shepherdwind/simple-evaluate.svg?style=flat-square\n[travis-url]: https://travis-ci.org/shepherdwind/simple-evaluate\n[coveralls-image]: https://img.shields.io/coveralls/shepherdwind/simple-evaluate.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/shepherdwind/simple-evaluate?branch=master\n\n\nA safe parse for simple js expression.\n\n### Usage\n\n```js\nimport evaluate from 'simple-evaluate';\nevaluate(null, '12 + 1 \u003e 14');\nevaluate({ a }, 'a + 1 \u003e 14');\n```\n\n### Support operation include\n\n- Math operator `+ - * / %`\n- ternary expression `a ? b : c`\n- Comparison `\u003e \u003c \u003e= \u003c= == != === !==`\n- Logical `\u0026\u0026 || !`\n- Negation\n\nYou can run those expression, for example:\n\n```js\nevaluate({}, '!a \u003e 0');\nevaluate({}, 'a \u003e 0 || a \u003c -12 || 12 + 2*(4 + 4) \u003c 12');\nevaluate({ a: 1 }, '-a * 2');\n```\n\n### context find\n\n`$.` stand for the root value all `context`, value path only support '.', and not support function call.\n\n\u003e since 1.2.0, `$.` is optional. That mean `$.a.b` is equal to `a.b`\n\n### string and boolean\n\nString and boolean support, string start with `' | \"`, just the same as javascript expression.\n\nBoolean use two key words, `true | false`.\n\n### template string\n\nYou can use template string, just like the javascript syntax, for example.\n\n```js\nevaluate({ a: 22 }, \"`I am ${ a \u003e= 18 ? 'adult' : 'child' }`\").should.equal('I am adult');\n```\n\n### Operation no support\n\n- Funcion call\n\nSo, you can not run those expression\n\n```js\nevaluation({}, 'a(1) \u003e 0');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepherdwind%2Fsimple-evaluate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshepherdwind%2Fsimple-evaluate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshepherdwind%2Fsimple-evaluate/lists"}