{"id":22428415,"url":"https://github.com/momsfriendlydevco/eval","last_synced_at":"2025-09-04T07:33:55.245Z","repository":{"id":78689327,"uuid":"244795725","full_name":"MomsFriendlyDevCo/eval","owner":"MomsFriendlyDevCo","description":"Safe evaluation of JavaScript(ish) expressions","archived":false,"fork":false,"pushed_at":"2020-03-05T00:20:58.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-28T21:35:18.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/MomsFriendlyDevCo.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-03-04T03:09:54.000Z","updated_at":"2020-03-12T04:00:06.000Z","dependencies_parsed_at":"2023-03-12T05:06:31.364Z","dependency_job_id":null,"html_url":"https://github.com/MomsFriendlyDevCo/eval","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MomsFriendlyDevCo/eval","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Feval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Feval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Feval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Feval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyDevCo","download_url":"https://codeload.github.com/MomsFriendlyDevCo/eval/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2Feval/sbom","scorecard":{"id":95741,"data":{"date":"2025-08-11","repo":{"name":"github.com/MomsFriendlyDevCo/eval","commit":"df66a620430b0aff27ef6e15024e8357f2fc72f2"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T08:59:21.701Z","repository_id":78689327,"created_at":"2025-08-15T08:59:21.701Z","updated_at":"2025-08-15T08:59:21.701Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273573457,"owners_count":25129881,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":[],"created_at":"2024-12-05T20:14:42.939Z","updated_at":"2025-09-04T07:33:55.237Z","avatar_url":"https://github.com/MomsFriendlyDevCo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@momsfriendlydevco/eval\n=======================\nSafe expression evaluator.\n\nThis function is an implementation of the [Shunting-Yard Alorithm](https://en.wikipedia.org/wiki/Shunting-yard_algorithm) which parses a regular JavaScript expression, runs it though a [Reverse Polish Notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation) parser and returns a result.\n\nThe output of this function is the evaluated result of the line, along with any optionally supplied context.\n\n\nExamples\n--------\n```javascript\nvar eval = require('@momsfriendlydevco/eval');\n\n// Simple evaluations\neval('1'); //= 1\neval('1 + 1'); //= 2\neval('\"a\" + \"b\" + \"c\"'); //= \"abc\"\n\n\n// Using an optional context\neval('foo + bar', {foo: 1, bar: 2}); //= 3\neval('foo(bar)', {foo: a =\u003e a, bar: 10}); //= 10\neval('add(10, 20)', {add: (a, b) =\u003e a + b}); //= 30\n```\n\n\nAPI\n===\n\neval(expression, context, options)\n----------------------------------\nEvaluate a JavaScript style expression and return the result.\nContext is an object of optional variables to allow access to or functions to support.\nDefault options can also be set in `eval.defaults`.\n\nOptions are:\n\n| Option       | Type              | Default  | Description                                                                                                              |\n|--------------|-------------------|----------|--------------------------------------------------------------------------------------------------------------------------|\n| `re`         | Object            | See code | List of Regular expressions used to parse the expression                                                                 |\n| `re.operand` | Boolean or RegExp | `false`  | The regular expression used to parse operands, if specifying your own operands this needs to be falsy to force recompile |\n| `operands`   | Object            | See code | List of Operands to support                                                                                              |\n\n\neval.defaults\n-------------\nObject of default values to use when calling `eval()`.\n\n\neval.get(target, path)\n----------------------\nInternal function to retrieve a dotted notation path in an expression. Similar to the [Lodash Get](https://lodash.com/docs#get) function.\n\n\neval.compileOperands(operands)\n------------------------------\nCompiler to return the optimized Regular Expression of the operands structure. Called automatically if `settings.re.operands` is falsy or on initalization of the module.\nInvoke this function manually and stash the result in defaults if defining a custom operand chain.\n\n```javascript\neval.defaults.re.operand = eval.compileOperands(eval.defaults.operands);\n```\n\n\n\nWhy?\n----\nThere are a number of reasons this module is necessary instead of using plain `eval()`:\n\n1. **Its safe** - Its _eval_, have you used it? Its not meant to be used for anything. Eval is massivly unsafe and unless used exactly right can cause major harm\n2. **Babel safe** - This module does not use any JS parsing, it uses its own internal lexing + parsing engine\n3. **Context is sandboxed** - Only exposed variables and functions are accessible within an expression, nothing else is accepted\n4. **Implements only a subset of the JS stanard** - Advanced JS concepts like Classes and Assignments are configurable (eventually - see the Todo list)\n\n\nTodo\n====\nLexical features of JavaScript and their support:\n\n| Precedence | Type                   | Syntax                                   | Supported |\n|------------|------------------------|------------------------------------------|-----------|\n|         21 | Parenthesis            | `(`, `)`                                 | Yes       |\n|         20 | Member access          | `a.b.c`                                  | Yes       |\n|         20 | New with arg list      | `new A()`                                |           |\n|         20 | Functions              | `a(b, c)`                                | Yes       |\n|         18 | Postfixes              | `a--`, `b++`                             |           |\n|         17 | Logical NOT            | `!a`                                     |           |\n|         17 | Bitwise NOT            | `~a`                                     |           |\n|         17 | Unary plus             | `+a`                                     |           |\n|         17 | Unary negation         | `-a`                                     |           |\n|         17 | Typeof                 | `typeof a`                               |           |\n|         17 | Void                   | `void`                                   |           |\n|         17 | Delete                 | `delete a`                               |           |\n|         17 | Await                  | `await a()`                              |           |\n|         16 | Exponentials           | `a ** b`                                 |           |\n|         15 | Multiplication         | `a * b`                                  | Yes       |\n|         15 | Division               | `a / b`                                  | Yes       |\n|         15 | Remainder              | `a % b`                                  | Yes       |\n|         14 | Addition               | `a + b`                                  | Yes       |\n|         14 | Subtraction            | `a - b`                                  | Yes       |\n|         13 | Bitwise shift          | `a \u003c\u003c b`, `a \u003e\u003e b`, `a \u003e\u003e\u003e b`            |           |\n|         12 | Lower than (or equal)  | `a \u003c b`, `a \u003c= b`                        | Yes       |\n|         12 | Higher than (or equal) | `a \u003e b`, `a \u003e= b`                        | Yes       |\n|         12 | In                     | `a in b`                                 |           |\n|         12 | Instance of            | `a instanceof b`                         |           |\n|         11 | (In)Equality           | `a == b`, `a != b`, `a === b`, `a !== b` | Yes       |\n|         10 | Bitwise AND            | `a \u0026 b`                                  |           |\n|          9 | Bitwise XOR            | `a ^ b`                                  |           |\n|          8 | Bitwise OR             | `a \\| b`                                 |           |\n|          7 | Nullish coalescing     | `a ?? b`                                 | Yes       |\n|          6 | Logical AND            | `a \u0026\u0026 b`                                 | Yes       |\n|          5 | Logical OR             | `a || b`                                 | Yes       |\n|          4 | Ternary                | `a ? b : c`                              |           |\n|          3 | Assignment             | `a = b`                                  |           |\n|          2 | Yield                  | `yield a` or `yield* a`                  |           |\n|          1 | Comma lists            | `a, b, c`                                |           |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Feval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlydevco%2Feval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Feval/lists"}