{"_id":"@casbin/expression-eval","_rev":"5-3d3fcd90a175520c772077a4ed7c4833","name":"@casbin/expression-eval","dist-tags":{"latest":"5.3.0"},"versions":{"5.0.2":{"name":"@casbin/expression-eval","version":"5.0.2","keywords":["expression","eval","evaluation","parser","ast","abstract","syntax","tree","math"],"author":{"name":"Node-Casbin"},"license":"MIT","_id":"@casbin/expression-eval@5.0.2","maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"homepage":"https://github.com/node-casbin/expression-eval#readme","bugs":{"url":"https://github.com/node-casbin/expression-eval/issues"},"dist":{"shasum":"652ab728598f9b011a8f7fea963e8fae40204be1","tarball":"https://registry.npmjs.org/@casbin/expression-eval/-/expression-eval-5.0.2.tgz","fileCount":3,"integrity":"sha512-mWiu8V2LXYqGk+IooPx59LEsPkZdmTqANIVz8VFM99bUzdhstoHU86rqQQ8o52UC/yUUL57OzgHZgB+1If5EWw==","signatures":[{"sig":"MEUCIQCeDD/qp3w0DBbn0fmLLLKgnf2Lhw96ALjO5Xhdl4D6jQIgbcUY+kWDJJ3oE6Xa5pouH5Za4xM80z1loJ4JxaGfo2I=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15240},"main":"dist/expression-eval.js","types":"dist/index.d.ts","unpkg":"dist/expression-eval.umd.js","module":"dist/expression-eval.module.js","source":"index.ts","gitHead":"d163a8ebbc8977351a43db45d7a41ae790cbb6aa","scripts":{"dev":"microbundle watch","lint":"eslint . --ext .ts","test":"jest","build":"microbundle","coverage":"jest --coverage","typecheck":"tsc --noEmit","preversion":"npm run build && npm test","postversion":"git push && git push --tags && npm publish"},"_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"repository":{"url":"git+https://github.com/node-casbin/expression-eval.git","type":"git"},"_npmVersion":"10.2.4","description":"JavaScript expression parsing and evaluation.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"jsep":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"24.9.0","eslint":"^8.49.0","ts-jest":"24.3.0","tap-spec":"^5.0.0","typescript":"^4.1.3","@types/jest":"24.9.0","microbundle":"^0.13.0","source-map-support":"^0.5.19","@typescript-eslint/parser":"^6.7.0","@typescript-eslint/eslint-plugin":"^6.7.0"},"_npmOperationalInternal":{"tmp":"tmp/expression-eval_5.0.2_1729773383098_0.33508126042228303","host":"s3://npm-registry-packages"}},"5.1.0":{"name":"@casbin/expression-eval","version":"5.1.0","keywords":["expression","eval","evaluation","parser","ast","abstract","syntax","tree","math"],"author":{"name":"Node-Casbin"},"license":"MIT","_id":"@casbin/expression-eval@5.1.0","maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"homepage":"https://github.com/node-casbin/expression-eval#readme","bugs":{"url":"https://github.com/node-casbin/expression-eval/issues"},"dist":{"shasum":"090ca6941a248ebfb3fe48903f3b66513e9d660b","tarball":"https://registry.npmjs.org/@casbin/expression-eval/-/expression-eval-5.1.0.tgz","fileCount":12,"integrity":"sha512-xzoYjs/sSC+EogyoN71DdvFD/N66asNxCMWUEAgoqZJ0OA4vZJ2j8Z7rwjP24KsNfsyCKT/e065J4cePwz933Q==","signatures":[{"sig":"MEYCIQCBPf7hSn+JrRyUB61cR6s9rVT26VEDI1WRuWirAQnXWwIhALpPOQTp2iOwxaJhW4cJVFJXawBLKuJH/x6G6S2Ipkkb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92369},"main":"dist/expression-eval.js","types":"dist/index.d.ts","unpkg":"dist/expression-eval.umd.js","module":"dist/expression-eval.module.js","source":"index.ts","gitHead":"ba888a96c51b921aa79f0a4cf4823f191a861ebd","scripts":{"dev":"microbundle watch","lint":"eslint . --ext .ts","test":"jest","build":"microbundle","coverage":"jest --coverage","typecheck":"tsc --noEmit","preversion":"npm run build && npm test","postversion":"git push && git push --tags && npm publish"},"_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"repository":{"url":"git+https://github.com/node-casbin/expression-eval.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript expression parsing and evaluation.","directories":{},"_nodeVersion":"20.18.0","dependencies":{"jsep":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"24.9.0","eslint":"^8.49.0","ts-jest":"24.3.0","tap-spec":"^5.0.0","typescript":"^4.1.3","@types/jest":"24.9.0","microbundle":"^0.13.0","source-map-support":"^0.5.19","@typescript-eslint/parser":"^6.7.0","@typescript-eslint/eslint-plugin":"^6.7.0"},"_npmOperationalInternal":{"tmp":"tmp/expression-eval_5.1.0_1729774377492_0.9976414958659248","host":"s3://npm-registry-packages"}},"5.2.0":{"name":"@casbin/expression-eval","version":"5.2.0","keywords":["expression","eval","evaluation","parser","ast","abstract","syntax","tree","math"],"author":{"name":"Node-Casbin"},"license":"MIT","_id":"@casbin/expression-eval@5.2.0","maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"homepage":"https://github.com/node-casbin/expression-eval#readme","bugs":{"url":"https://github.com/node-casbin/expression-eval/issues"},"dist":{"shasum":"a388405077acfca0d9e223a969eb78d0a6c83aaa","tarball":"https://registry.npmjs.org/@casbin/expression-eval/-/expression-eval-5.2.0.tgz","fileCount":12,"integrity":"sha512-QNyxosVLIyMRPemwLs5IkuEp81YXMxb6uX/Y1dVR9Z8mCRfZjy/FWV1TuKz5q84oKbXwwo7Wg1IBMQ8Jgcw43g==","signatures":[{"sig":"MEUCIQDGGL/foBDL7HGlffJLJFXBE+wldSgwyCpECUb0k9BBXQIgQg/ZnQStUVDIDXrT8qvpwA0luNnBVIWUHmx+Mimda70=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":92712},"main":"dist/expression-eval.js","types":"dist/index.d.ts","unpkg":"dist/expression-eval.umd.js","module":"dist/expression-eval.module.js","source":"index.ts","gitHead":"36d0f7bdafa73e903edf530ba68e1b8781946596","scripts":{"dev":"microbundle watch","lint":"eslint . --ext .ts","test":"jest","build":"microbundle","release":"standard-version","coverage":"jest --coverage","typecheck":"tsc --noEmit","prepublish":"yarn lint && yarn build"},"_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"repository":{"url":"git+https://github.com/node-casbin/expression-eval.git","type":"git"},"_npmVersion":"10.9.0","description":"JavaScript expression parsing and evaluation.","directories":{},"_nodeVersion":"20.18.0","dependencies":{"jsep":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"24.9.0","eslint":"^8.49.0","ts-jest":"24.3.0","tap-spec":"^5.0.0","typescript":"^4.1.3","@types/jest":"24.9.0","microbundle":"^0.13.0","source-map-support":"^0.5.19","@typescript-eslint/parser":"^6.7.0","@typescript-eslint/eslint-plugin":"^6.7.0"},"_npmOperationalInternal":{"tmp":"tmp/expression-eval_5.2.0_1730010524863_0.6042266883680463","host":"s3://npm-registry-packages"}},"5.3.0":{"name":"@casbin/expression-eval","version":"5.3.0","description":"JavaScript expression parsing and evaluation.","source":"index.ts","main":"dist/expression-eval.js","module":"dist/expression-eval.module.js","unpkg":"dist/expression-eval.umd.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/node-casbin/expression-eval.git"},"scripts":{"dev":"microbundle watch","build":"microbundle","test":"jest","prepublish":"yarn lint && yarn build","release":"standard-version","typecheck":"tsc --noEmit","lint":"eslint . --ext .ts","coverage":"jest --coverage"},"keywords":["expression","eval","evaluation","parser","ast","abstract","syntax","tree","math"],"author":{"name":"Node-Casbin"},"license":"MIT","dependencies":{"jsep":"^0.3.0"},"devDependencies":{"@types/jest":"24.9.0","@typescript-eslint/eslint-plugin":"^6.7.0","@typescript-eslint/parser":"^6.7.0","eslint":"^8.49.0","jest":"24.9.0","ts-jest":"24.3.0","microbundle":"^0.13.0","source-map-support":"^0.5.19","tap-spec":"^5.0.0","typescript":"^4.1.3"},"_id":"@casbin/expression-eval@5.3.0","gitHead":"853a2f081e1b9f2c2761a00406d3888094520144","bugs":{"url":"https://github.com/node-casbin/expression-eval/issues"},"homepage":"https://github.com/node-casbin/expression-eval#readme","_nodeVersion":"20.18.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-mMTHMYXcnBBv/zMvxMpcdVyt2bfw8Y0GnmRLbkFQ1CVJZb4XZp7xWjRh7ymOLuJdsu58rci9gmOOv/99DtJvPA==","shasum":"4721504cbc1fcd7e334c01e44f257ca1f9e2550b","tarball":"https://registry.npmjs.org/@casbin/expression-eval/-/expression-eval-5.3.0.tgz","fileCount":12,"unpackedSize":93726,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVNNQYgvB/4tGQhkS4KMhu++Nwqh0E+aBPPyXWu7m36QIhAPeKe2HbwFMs8R8inntlrYBjuYMwSDkQq37Ds/D+jE6p"}]},"_npmUser":{"name":"hsluoyz","email":"hsluoyz@gmail.com"},"directories":{},"maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/expression-eval_5.3.0_1732029660083_0.04859571295696785"},"_hasShrinkwrap":false}},"time":{"created":"2024-10-24T12:36:22.954Z","modified":"2024-11-19T15:21:00.564Z","5.0.2":"2024-10-24T12:36:23.296Z","1.0.0":"2024-10-24T12:42:23.039Z","5.1.0":"2024-10-24T12:52:57.694Z","5.2.0":"2024-10-27T06:28:45.168Z","5.3.0":"2024-11-19T15:21:00.371Z"},"bugs":{"url":"https://github.com/node-casbin/expression-eval/issues"},"author":{"name":"Node-Casbin"},"license":"MIT","homepage":"https://github.com/node-casbin/expression-eval#readme","keywords":["expression","eval","evaluation","parser","ast","abstract","syntax","tree","math"],"repository":{"type":"git","url":"git+https://github.com/node-casbin/expression-eval.git"},"description":"JavaScript expression parsing and evaluation.","maintainers":[{"name":"hsluoyz","email":"hsluoyz@gmail.com"}],"readme":"# expression-eval\n\n[![NPM version][npm-image]][npm-url]\n[![NPM download][download-image]][download-url]\n[![ci](https://github.com/node-casbin/expression-eval/actions/workflows/ci.yml/badge.svg)](https://github.com/node-casbin/expression-eval/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/node-casbin/expression-eval/badge.svg?branch=master)](https://coveralls.io/github/node-casbin/expression-eval?branch=master)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)\n\n[npm-image]: https://img.shields.io/npm/v/@casbin/expression-eval.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/@casbin/expression-eval\n[download-image]: https://img.shields.io/npm/dm/@casbin/expression-eval.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@casbin/expression-eval\n\nJavaScript expression parsing and evaluation.\n\nPowered by [jsep](https://github.com/soney/jsep).\n\n## Installation\n\nInstall:\n\n```\nnpm install --save @casbin/expression-eval\n```\n\nImport:\n\n```js\n// ES6\nimport { parse, eval } from '@casbin/expression-eval';\n// CommonJS\nconst { parse, eval } = require('@casbin/expression-eval');\n// UMD / standalone script\nconst { parse, eval } = window['@casbin/expression-eval'];\n```\n\n## API\n\n### Parsing\n\n```javascript\nimport { parse } from '@casbin/expression-eval';\nconst ast = parse('1 + foo');\n```\n\nThe result of the parse is an AST (abstract syntax tree), like:\n\n```json\n{\n  \"type\": \"BinaryExpression\",\n  \"operator\": \"+\",\n  \"left\": {\n    \"type\": \"Literal\",\n    \"value\": 1,\n    \"raw\": \"1\"\n  },\n  \"right\": {\n    \"type\": \"Identifier\",\n    \"name\": \"foo\"\n  }\n}\n```\n\n### Evaluation\n\n```javascript\nimport { parse, eval } from '@casbin/expression-eval';\nconst ast = parse('a + b / c'); // abstract syntax tree (AST)\nconst value = eval(ast, {a: 2, b: 2, c: 5}); // 2.4\n```\n\nAlternatively, use `evalAsync` for asynchronous evaluation.\n\n### Compilation\n\n```javascript\nimport { compile } from '@casbin/expression-eval';\nconst fn = compile('foo.bar + 10');\nfn({foo: {bar: 'baz'}}); // 'baz10'\n```\n\nAlternatively, use `compileAsync` for asynchronous compilation.\n\n## Security\n\nAlthough this package does [avoid the use of `eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#Do_not_ever_use_eval!), it _cannot guarantee that user-provided expressions, or user-provided inputs to evaluation, will not modify the state or behavior of your application_. This library does not attempt to provide a secure sandbox for evaluation. Evaluation of arbitrary user inputs (expressions or values) may lead to unsafe behavior. If your project requires a secure sandbox, consider alternatives such as [vm2](https://www.npmjs.com/package/vm2).\n\n## License\n\nApache 2.0 License.\n","readmeFilename":"README.md"}