Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@casbin/expression-eval

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@casbin/expression-eval - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

2

dist/expression-eval.js

@@ -1,2 +0,2 @@

function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/e(require("jsep")),n=function(e,r){try{var u=e;switch(u.type){case"ArrayExpression":return Promise.resolve(o(u.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([n(u.left,r),n(u.right,r)])).then(function(e){return i[u.operator](e[0],e[1])});case"CallExpression":var c,a,l,f=function(){if("function"==typeof a){var e=a,n=e.apply,t=c;return Promise.resolve(o(u.arguments,r)).then(function(r){return Promise.resolve(n.call(e,t,r))})}},p="MemberExpression"===u.callee.type?Promise.resolve(t(u.callee,r)).then(function(e){c=(l=e)[0],a=l[1]}):Promise.resolve(n(u.callee,r)).then(function(e){a=e});return Promise.resolve(p&&p.then?p.then(f):f());case"ConditionalExpression":return Promise.resolve(n(u.test,r)).then(function(e){return Promise.resolve(n(e?u.consequent:u.alternate,r))});case"Identifier":return Promise.resolve(r[u.name]);case"Literal":return Promise.resolve(u.value);case"LogicalExpression":var m=function(e){return Promise.resolve(Promise.all([n(u.left,r),n(u.right,r)])).then(function(e){return i[u.operator](e[0],e[1])})},v=function(){if("||"===u.operator)return Promise.resolve(n(u.right,r)).then(function(){});var e=function(){if("&&"===u.operator)return Promise.resolve(n(u.right,r)).then(function(){})}();return e&&e.then?e.then(function(){}):void 0}();return Promise.resolve(v&&v.then?v.then(m):m());case"MemberExpression":return Promise.resolve(t(u,r)).then(function(e){return e[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var h=s[u.operator];return Promise.resolve(n(u.argument,r)).then(function(e){return h.call(s,e)});default:return Promise.resolve(void 0)}}catch(e){return Promise.reject(e)}},t=function(e,r){try{return Promise.resolve(n(e.object,r)).then(function(t){function o(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[t,t[u]]}var u,i=function(){if(e.computed)return Promise.resolve(n(e.property,r)).then(function(e){u=e});u=e.property.name}();return i&&i.then?i.then(o):o()})}catch(e){return Promise.reject(e)}},o=function(e,r){try{return Promise.resolve(Promise.all(e.map(function(e){return n(e,r)})))}catch(e){return Promise.reject(e)}},u={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},i={"||":function(e,r){return e||r},"&&":function(e,r){return e&&r},"|":function(e,r){return e|r},"^":function(e,r){return e^r},"&":function(e,r){return e&r},"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},"===":function(e,r){return e===r},"!==":function(e,r){return e!==r},"<":function(e,r){return e<r},">":function(e,r){return e>r},"<=":function(e,r){return e<=r},">=":function(e,r){return e>=r},"<<":function(e,r){return e<<r},">>":function(e,r){return e>>r},">>>":function(e,r){return e>>>r},"+":function(e,r){return e+r},"-":function(e,r){return e-r},"*":function(e,r){return e*r},"/":function(e,r){return e/r},"%":function(e,r){return e%r}},s={"-":function(e){return-e},"+":function(e){return+e},"~":function(e){return~e},"!":function(e){return!e}};function c(e,r){return e.map(function(e){return l(e,r)})}function a(e,r){var n,t=l(e.object,r);if(n=e.computed?l(e.property,r):e.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function l(e,r){var n=e;switch(n.type){case"ArrayExpression":return c(n.elements,r);case"BinaryExpression":return i[n.operator](l(n.left,r),l(n.right,r));case"CallExpression":var t,o,u;if("MemberExpression"===n.callee.type?(t=(u=a(n.callee,r))[0],o=u[1]):o=l(n.callee,r),"function"!=typeof o)return;return o.apply(t,c(n.arguments,r));case"ConditionalExpression":return l(n.test,r)?l(n.consequent,r):l(n.alternate,r);case"Identifier":return r[n.name];case"Literal":return n.value;case"LogicalExpression":return"||"===n.operator?l(n.left,r)||l(n.right,r):"&&"===n.operator?l(n.left,r)&&l(n.right,r):i[n.operator](l(n.left,r),l(n.right,r));case"MemberExpression":return a(n,r)[1];case"ThisExpression":return r;case"UnaryExpression":return s[n.operator](l(n.argument,r));default:return}}Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return r.default}}),exports.addBinaryOp=function(e,n,t){t?(r.default.addBinaryOp(e,n),i[e]=t):(r.default.addBinaryOp(e,u[e]||1),i[e]=n)},exports.addUnaryOp=function(e,n){r.default.addUnaryOp(e),s[e]=n},exports.compile=function(e){return l.bind(null,r.default(e))},exports.compileAsync=function(e){return n.bind(null,r.default(e))},exports.eval=l,exports.evalAsync=n;
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/e(require("jsep")),n=function(e,r){try{var u,c=e;switch(c.type){case"ArrayExpression":return Promise.resolve(o(c.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([n(c.left,r),n(c.right,r)])).then(function(e){return i[c.operator](e[0],e[1])});case"CallExpression":var a,l,f,p=function(){if("function"==typeof l){var e=l,n=e.apply,t=a;return Promise.resolve(o(c.arguments,r)).then(function(r){return Promise.resolve(n.call(e,t,r))})}},m="MemberExpression"===c.callee.type?Promise.resolve(t(c.callee,r)).then(function(e){a=(f=e)[0],l=f[1]}):Promise.resolve(n(c.callee,r)).then(function(e){l=e});return Promise.resolve(m&&m.then?m.then(p):p());case"ConditionalExpression":return Promise.resolve(n(c.test,r)).then(function(e){return Promise.resolve(n(e?c.consequent:c.alternate,r))});case"Identifier":return Promise.resolve(r[c.name]);case"Literal":return Promise.resolve(c.value);case"LogicalExpression":var v=function(e){return u?e:Promise.resolve(Promise.all([n(c.left,r),n(c.right,r)])).then(function(e){return i[c.operator](e[0],e[1])})},h="||"===c.operator?Promise.resolve(n(c.left,r)).then(function(e){return e?(u=1,e):Promise.resolve(n(c.right,r)).then(function(e){return u=1,e})}):function(){if("&&"===c.operator)return Promise.resolve(n(c.left,r)).then(function(e){return e?Promise.resolve(n(c.right,r)).then(function(e){return u=1,e}):(u=1,e)})}();return Promise.resolve(h&&h.then?h.then(v):v(h));case"MemberExpression":return Promise.resolve(t(c,r)).then(function(e){return e[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var d=s[c.operator];return Promise.resolve(n(c.argument,r)).then(function(e){return d.call(s,e)});default:return Promise.resolve(void 0)}}catch(e){return Promise.reject(e)}},t=function(e,r){try{return Promise.resolve(n(e.object,r)).then(function(t){function o(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[t,t[u]]}var u,i=function(){if(e.computed)return Promise.resolve(n(e.property,r)).then(function(e){u=e});u=e.property.name}();return i&&i.then?i.then(o):o()})}catch(e){return Promise.reject(e)}},o=function(e,r){try{return Promise.resolve(Promise.all(e.map(function(e){return n(e,r)})))}catch(e){return Promise.reject(e)}},u={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},i={"||":function(e,r){return e||r},"&&":function(e,r){return e&&r},"|":function(e,r){return e|r},"^":function(e,r){return e^r},"&":function(e,r){return e&r},"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},"===":function(e,r){return e===r},"!==":function(e,r){return e!==r},"<":function(e,r){return e<r},">":function(e,r){return e>r},"<=":function(e,r){return e<=r},">=":function(e,r){return e>=r},"<<":function(e,r){return e<<r},">>":function(e,r){return e>>r},">>>":function(e,r){return e>>>r},"+":function(e,r){return e+r},"-":function(e,r){return e-r},"*":function(e,r){return e*r},"/":function(e,r){return e/r},"%":function(e,r){return e%r}},s={"-":function(e){return-e},"+":function(e){return+e},"~":function(e){return~e},"!":function(e){return!e}};function c(e,r){return e.map(function(e){return l(e,r)})}function a(e,r){var n,t=l(e.object,r);if(n=e.computed?l(e.property,r):e.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function l(e,r){var n=e;switch(n.type){case"ArrayExpression":return c(n.elements,r);case"BinaryExpression":return i[n.operator](l(n.left,r),l(n.right,r));case"CallExpression":var t,o,u;if("MemberExpression"===n.callee.type?(t=(u=a(n.callee,r))[0],o=u[1]):o=l(n.callee,r),"function"!=typeof o)return;return o.apply(t,c(n.arguments,r));case"ConditionalExpression":return l(n.test,r)?l(n.consequent,r):l(n.alternate,r);case"Identifier":return r[n.name];case"Literal":return n.value;case"LogicalExpression":var f=l(n.left,r);return"||"===n.operator&&f?f:"&&"!==n.operator||f?i[n.operator](f,l(n.right,r)):f;case"MemberExpression":return a(n,r)[1];case"ThisExpression":return r;case"UnaryExpression":return s[n.operator](l(n.argument,r));default:return}}Object.defineProperty(exports,"parse",{enumerable:!0,get:function(){return r.default}}),exports.addBinaryOp=function(e,n,t){t?(r.default.addBinaryOp(e,n),i[e]=t):(r.default.addBinaryOp(e,u[e]||1),i[e]=n)},exports.addUnaryOp=function(e,n){r.default.addUnaryOp(e),s[e]=n},exports.compile=function(e){return l.bind(null,r.default(e))},exports.compileAsync=function(e){return n.bind(null,r.default(e))},exports.eval=l,exports.evalAsync=n;
//# sourceMappingURL=expression-eval.js.map

@@ -1,2 +0,2 @@

import r from"jsep";export{default as parse}from"jsep";const t={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},e={"||":function(r,t){return r||t},"&&":function(r,t){return r&&t},"|":function(r,t){return r|t},"^":function(r,t){return r^t},"&":function(r,t){return r&t},"==":function(r,t){return r==t},"!=":function(r,t){return r!=t},"===":function(r,t){return r===t},"!==":function(r,t){return r!==t},"<":function(r,t){return r<t},">":function(r,t){return r>t},"<=":function(r,t){return r<=t},">=":function(r,t){return r>=t},"<<":function(r,t){return r<<t},">>":function(r,t){return r>>t},">>>":function(r,t){return r>>>t},"+":function(r,t){return r+t},"-":function(r,t){return r-t},"*":function(r,t){return r*t},"/":function(r,t){return r/t},"%":function(r,t){return r%t}},n={"-":function(r){return-r},"+":function(r){return+r},"~":function(r){return~r},"!":function(r){return!r}};function o(r,t){return r.map(function(r){return s(r,t)})}async function a(r,t){return await Promise.all(r.map(r=>c(r,t)))}function i(r,t){const e=s(r.object,t);let n;if(n=r.computed?s(r.property,t):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[e,e[n]]}async function u(r,t){const e=await c(r.object,t);let n;if(n=r.computed?await c(r.property,t):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[e,e[n]]}function s(r,t){const a=r;switch(a.type){case"ArrayExpression":return o(a.elements,t);case"BinaryExpression":return e[a.operator](s(a.left,t),s(a.right,t));case"CallExpression":{let r,e,n;if("MemberExpression"===a.callee.type?(n=i(a.callee,t),r=n[0],e=n[1]):e=s(a.callee,t),"function"!=typeof e)return;return e.apply(r,o(a.arguments,t))}case"ConditionalExpression":return s(a.test,t)?s(a.consequent,t):s(a.alternate,t);case"Identifier":return t[a.name];case"Literal":return a.value;case"LogicalExpression":return"||"===a.operator?s(a.left,t)||s(a.right,t):"&&"===a.operator?s(a.left,t)&&s(a.right,t):e[a.operator](s(a.left,t),s(a.right,t));case"MemberExpression":return i(a,t)[1];case"ThisExpression":return t;case"UnaryExpression":return n[a.operator](s(a.argument,t));default:return}}async function c(r,t){const o=r;switch(o.type){case"ArrayExpression":return await a(o.elements,t);case"BinaryExpression":{const[r,n]=await Promise.all([c(o.left,t),c(o.right,t)]);return e[o.operator](r,n)}case"CallExpression":{let r,e,n;if("MemberExpression"===o.callee.type?(n=await u(o.callee,t),r=n[0],e=n[1]):e=await c(o.callee,t),"function"!=typeof e)return;return await e.apply(r,await a(o.arguments,t))}case"ConditionalExpression":return await c(o.test,t)?await c(o.consequent,t):await c(o.alternate,t);case"Identifier":return t[o.name];case"Literal":return o.value;case"LogicalExpression":{if("||"===o.operator)return await c(o.left,t)||await c(o.right,t);if("&&"===o.operator)return await c(o.left,t)&&await c(o.right,t);const[r,n]=await Promise.all([c(o.left,t),c(o.right,t)]);return e[o.operator](r,n)}case"MemberExpression":return(await u(o,t))[1];case"ThisExpression":return t;case"UnaryExpression":return n[o.operator](await c(o.argument,t));default:return}}function p(t){return s.bind(null,r(t))}function f(t){return c.bind(null,r(t))}function l(t,e){r.addUnaryOp(t),n[t]=e}function m(n,o,a){a?(r.addBinaryOp(n,o),e[n]=a):(r.addBinaryOp(n,t[n]||1),e[n]=o)}export{m as addBinaryOp,l as addUnaryOp,p as compile,f as compileAsync,s as eval,c as evalAsync};
import r from"jsep";export{default as parse}from"jsep";const t={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},e={"||":function(r,t){return r||t},"&&":function(r,t){return r&&t},"|":function(r,t){return r|t},"^":function(r,t){return r^t},"&":function(r,t){return r&t},"==":function(r,t){return r==t},"!=":function(r,t){return r!=t},"===":function(r,t){return r===t},"!==":function(r,t){return r!==t},"<":function(r,t){return r<t},">":function(r,t){return r>t},"<=":function(r,t){return r<=t},">=":function(r,t){return r>=t},"<<":function(r,t){return r<<t},">>":function(r,t){return r>>t},">>>":function(r,t){return r>>>t},"+":function(r,t){return r+t},"-":function(r,t){return r-t},"*":function(r,t){return r*t},"/":function(r,t){return r/t},"%":function(r,t){return r%t}},n={"-":function(r){return-r},"+":function(r){return+r},"~":function(r){return~r},"!":function(r){return!r}};function o(r,t){return r.map(function(r){return s(r,t)})}async function a(r,t){return await Promise.all(r.map(r=>c(r,t)))}function i(r,t){const e=s(r.object,t);let n;if(n=r.computed?s(r.property,t):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[e,e[n]]}async function u(r,t){const e=await c(r.object,t);let n;if(n=r.computed?await c(r.property,t):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error(`Access to member "${n}" disallowed.`);return[e,e[n]]}function s(r,t){const a=r;switch(a.type){case"ArrayExpression":return o(a.elements,t);case"BinaryExpression":return e[a.operator](s(a.left,t),s(a.right,t));case"CallExpression":{let r,e,n;if("MemberExpression"===a.callee.type?(n=i(a.callee,t),r=n[0],e=n[1]):e=s(a.callee,t),"function"!=typeof e)return;return e.apply(r,o(a.arguments,t))}case"ConditionalExpression":return s(a.test,t)?s(a.consequent,t):s(a.alternate,t);case"Identifier":return t[a.name];case"Literal":return a.value;case"LogicalExpression":const r=s(a.left,t);return"||"===a.operator&&r?r:"&&"!==a.operator||r?e[a.operator](r,s(a.right,t)):r;case"MemberExpression":return i(a,t)[1];case"ThisExpression":return t;case"UnaryExpression":return n[a.operator](s(a.argument,t));default:return}}async function c(r,t){const o=r;switch(o.type){case"ArrayExpression":return await a(o.elements,t);case"BinaryExpression":{const[r,n]=await Promise.all([c(o.left,t),c(o.right,t)]);return e[o.operator](r,n)}case"CallExpression":{let r,e,n;if("MemberExpression"===o.callee.type?(n=await u(o.callee,t),r=n[0],e=n[1]):e=await c(o.callee,t),"function"!=typeof e)return;return await e.apply(r,await a(o.arguments,t))}case"ConditionalExpression":return await c(o.test,t)?await c(o.consequent,t):await c(o.alternate,t);case"Identifier":return t[o.name];case"Literal":return o.value;case"LogicalExpression":{if("||"===o.operator)return await c(o.left,t)||await c(o.right,t);if("&&"===o.operator){const r=await c(o.left,t);return r?await c(o.right,t):r}const[r,n]=await Promise.all([c(o.left,t),c(o.right,t)]);return e[o.operator](r,n)}case"MemberExpression":return(await u(o,t))[1];case"ThisExpression":return t;case"UnaryExpression":return n[o.operator](await c(o.argument,t));default:return}}function p(t){return s.bind(null,r(t))}function f(t){return c.bind(null,r(t))}function l(t,e){r.addUnaryOp(t),n[t]=e}function m(n,o,a){a?(r.addBinaryOp(n,o),e[n]=a):(r.addBinaryOp(n,t[n]||1),e[n]=o)}export{m as addBinaryOp,l as addUnaryOp,p as compile,f as compileAsync,s as eval,c as evalAsync};
//# sourceMappingURL=expression-eval.modern.js.map

@@ -1,2 +0,2 @@

import r from"jsep";export{default as parse}from"jsep";var e=function(r,o){try{var s=r;switch(s.type){case"ArrayExpression":return Promise.resolve(t(s.elements,o));case"BinaryExpression":return Promise.resolve(Promise.all([e(s.left,o),e(s.right,o)])).then(function(r){return u[s.operator](r[0],r[1])});case"CallExpression":var c,a,l,f=function(){if("function"==typeof a){var r=a,e=r.apply,n=c;return Promise.resolve(t(s.arguments,o)).then(function(t){return Promise.resolve(e.call(r,n,t))})}},p="MemberExpression"===s.callee.type?Promise.resolve(n(s.callee,o)).then(function(r){c=(l=r)[0],a=l[1]}):Promise.resolve(e(s.callee,o)).then(function(r){a=r});return Promise.resolve(p&&p.then?p.then(f):f());case"ConditionalExpression":return Promise.resolve(e(s.test,o)).then(function(r){return Promise.resolve(e(r?s.consequent:s.alternate,o))});case"Identifier":return Promise.resolve(o[s.name]);case"Literal":return Promise.resolve(s.value);case"LogicalExpression":var m=function(r){return Promise.resolve(Promise.all([e(s.left,o),e(s.right,o)])).then(function(r){return u[s.operator](r[0],r[1])})},v=function(){if("||"===s.operator)return Promise.resolve(e(s.right,o)).then(function(){});var r=function(){if("&&"===s.operator)return Promise.resolve(e(s.right,o)).then(function(){})}();return r&&r.then?r.then(function(){}):void 0}();return Promise.resolve(v&&v.then?v.then(m):m());case"MemberExpression":return Promise.resolve(n(s,o)).then(function(r){return r[1]});case"ThisExpression":return Promise.resolve(o);case"UnaryExpression":var h=i[s.operator];return Promise.resolve(e(s.argument,o)).then(function(r){return h.call(i,r)});default:return Promise.resolve(void 0)}}catch(r){return Promise.reject(r)}},n=function(r,n){try{return Promise.resolve(e(r.object,n)).then(function(t){function o(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[t,t[u]]}var u,i=function(){if(r.computed)return Promise.resolve(e(r.property,n)).then(function(r){u=r});u=r.property.name}();return i&&i.then?i.then(o):o()})}catch(r){return Promise.reject(r)}},t=function(r,n){try{return Promise.resolve(Promise.all(r.map(function(r){return e(r,n)})))}catch(r){return Promise.reject(r)}},o={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},u={"||":function(r,e){return r||e},"&&":function(r,e){return r&&e},"|":function(r,e){return r|e},"^":function(r,e){return r^e},"&":function(r,e){return r&e},"==":function(r,e){return r==e},"!=":function(r,e){return r!=e},"===":function(r,e){return r===e},"!==":function(r,e){return r!==e},"<":function(r,e){return r<e},">":function(r,e){return r>e},"<=":function(r,e){return r<=e},">=":function(r,e){return r>=e},"<<":function(r,e){return r<<e},">>":function(r,e){return r>>e},">>>":function(r,e){return r>>>e},"+":function(r,e){return r+e},"-":function(r,e){return r-e},"*":function(r,e){return r*e},"/":function(r,e){return r/e},"%":function(r,e){return r%e}},i={"-":function(r){return-r},"+":function(r){return+r},"~":function(r){return~r},"!":function(r){return!r}};function s(r,e){return r.map(function(r){return a(r,e)})}function c(r,e){var n,t=a(r.object,e);if(n=r.computed?a(r.property,e):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function a(r,e){var n=r;switch(n.type){case"ArrayExpression":return s(n.elements,e);case"BinaryExpression":return u[n.operator](a(n.left,e),a(n.right,e));case"CallExpression":var t,o,l;if("MemberExpression"===n.callee.type?(t=(l=c(n.callee,e))[0],o=l[1]):o=a(n.callee,e),"function"!=typeof o)return;return o.apply(t,s(n.arguments,e));case"ConditionalExpression":return a(n.test,e)?a(n.consequent,e):a(n.alternate,e);case"Identifier":return e[n.name];case"Literal":return n.value;case"LogicalExpression":return"||"===n.operator?a(n.left,e)||a(n.right,e):"&&"===n.operator?a(n.left,e)&&a(n.right,e):u[n.operator](a(n.left,e),a(n.right,e));case"MemberExpression":return c(n,e)[1];case"ThisExpression":return e;case"UnaryExpression":return i[n.operator](a(n.argument,e));default:return}}function l(e){return a.bind(null,r(e))}function f(n){return e.bind(null,r(n))}function p(e,n){r.addUnaryOp(e),i[e]=n}function m(e,n,t){t?(r.addBinaryOp(e,n),u[e]=t):(r.addBinaryOp(e,o[e]||1),u[e]=n)}export{m as addBinaryOp,p as addUnaryOp,l as compile,f as compileAsync,a as eval,e as evalAsync};
import r from"jsep";export{default as parse}from"jsep";var e=function(r,o){try{var s,c=r;switch(c.type){case"ArrayExpression":return Promise.resolve(t(c.elements,o));case"BinaryExpression":return Promise.resolve(Promise.all([e(c.left,o),e(c.right,o)])).then(function(r){return u[c.operator](r[0],r[1])});case"CallExpression":var a,l,f,p=function(){if("function"==typeof l){var r=l,e=r.apply,n=a;return Promise.resolve(t(c.arguments,o)).then(function(t){return Promise.resolve(e.call(r,n,t))})}},m="MemberExpression"===c.callee.type?Promise.resolve(n(c.callee,o)).then(function(r){a=(f=r)[0],l=f[1]}):Promise.resolve(e(c.callee,o)).then(function(r){l=r});return Promise.resolve(m&&m.then?m.then(p):p());case"ConditionalExpression":return Promise.resolve(e(c.test,o)).then(function(r){return Promise.resolve(e(r?c.consequent:c.alternate,o))});case"Identifier":return Promise.resolve(o[c.name]);case"Literal":return Promise.resolve(c.value);case"LogicalExpression":var v=function(r){return s?r:Promise.resolve(Promise.all([e(c.left,o),e(c.right,o)])).then(function(r){return u[c.operator](r[0],r[1])})},h="||"===c.operator?Promise.resolve(e(c.left,o)).then(function(r){return r?(s=1,r):Promise.resolve(e(c.right,o)).then(function(r){return s=1,r})}):function(){if("&&"===c.operator)return Promise.resolve(e(c.left,o)).then(function(r){return r?Promise.resolve(e(c.right,o)).then(function(r){return s=1,r}):(s=1,r)})}();return Promise.resolve(h&&h.then?h.then(v):v(h));case"MemberExpression":return Promise.resolve(n(c,o)).then(function(r){return r[1]});case"ThisExpression":return Promise.resolve(o);case"UnaryExpression":var P=i[c.operator];return Promise.resolve(e(c.argument,o)).then(function(r){return P.call(i,r)});default:return Promise.resolve(void 0)}}catch(r){return Promise.reject(r)}},n=function(r,n){try{return Promise.resolve(e(r.object,n)).then(function(t){function o(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[t,t[u]]}var u,i=function(){if(r.computed)return Promise.resolve(e(r.property,n)).then(function(r){u=r});u=r.property.name}();return i&&i.then?i.then(o):o()})}catch(r){return Promise.reject(r)}},t=function(r,n){try{return Promise.resolve(Promise.all(r.map(function(r){return e(r,n)})))}catch(r){return Promise.reject(r)}},o={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},u={"||":function(r,e){return r||e},"&&":function(r,e){return r&&e},"|":function(r,e){return r|e},"^":function(r,e){return r^e},"&":function(r,e){return r&e},"==":function(r,e){return r==e},"!=":function(r,e){return r!=e},"===":function(r,e){return r===e},"!==":function(r,e){return r!==e},"<":function(r,e){return r<e},">":function(r,e){return r>e},"<=":function(r,e){return r<=e},">=":function(r,e){return r>=e},"<<":function(r,e){return r<<e},">>":function(r,e){return r>>e},">>>":function(r,e){return r>>>e},"+":function(r,e){return r+e},"-":function(r,e){return r-e},"*":function(r,e){return r*e},"/":function(r,e){return r/e},"%":function(r,e){return r%e}},i={"-":function(r){return-r},"+":function(r){return+r},"~":function(r){return~r},"!":function(r){return!r}};function s(r,e){return r.map(function(r){return a(r,e)})}function c(r,e){var n,t=a(r.object,e);if(n=r.computed?a(r.property,e):r.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function a(r,e){var n=r;switch(n.type){case"ArrayExpression":return s(n.elements,e);case"BinaryExpression":return u[n.operator](a(n.left,e),a(n.right,e));case"CallExpression":var t,o,l;if("MemberExpression"===n.callee.type?(t=(l=c(n.callee,e))[0],o=l[1]):o=a(n.callee,e),"function"!=typeof o)return;return o.apply(t,s(n.arguments,e));case"ConditionalExpression":return a(n.test,e)?a(n.consequent,e):a(n.alternate,e);case"Identifier":return e[n.name];case"Literal":return n.value;case"LogicalExpression":var f=a(n.left,e);return"||"===n.operator&&f?f:"&&"!==n.operator||f?u[n.operator](f,a(n.right,e)):f;case"MemberExpression":return c(n,e)[1];case"ThisExpression":return e;case"UnaryExpression":return i[n.operator](a(n.argument,e));default:return}}function l(e){return a.bind(null,r(e))}function f(n){return e.bind(null,r(n))}function p(e,n){r.addUnaryOp(e),i[e]=n}function m(e,n,t){t?(r.addBinaryOp(e,n),u[e]=t):(r.addBinaryOp(e,o[e]||1),u[e]=n)}export{m as addBinaryOp,p as addUnaryOp,l as compile,f as compileAsync,a as eval,e as evalAsync};
//# sourceMappingURL=expression-eval.module.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("jsep")):"function"==typeof define&&define.amd?define(["exports","jsep"],r):r((e||self).expressionEval={},e.jsep)}(this,function(e,r){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=/*#__PURE__*/n(r),o=function(e,r){try{var n=e;switch(n.type){case"ArrayExpression":return Promise.resolve(i(n.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([o(n.left,r),o(n.right,r)])).then(function(e){return c[n.operator](e[0],e[1])});case"CallExpression":var t,s,f,l=function(){if("function"==typeof s){var e=s,o=e.apply,u=t;return Promise.resolve(i(n.arguments,r)).then(function(r){return Promise.resolve(o.call(e,u,r))})}},p="MemberExpression"===n.callee.type?Promise.resolve(u(n.callee,r)).then(function(e){t=(f=e)[0],s=f[1]}):Promise.resolve(o(n.callee,r)).then(function(e){s=e});return Promise.resolve(p&&p.then?p.then(l):l());case"ConditionalExpression":return Promise.resolve(o(n.test,r)).then(function(e){return Promise.resolve(o(e?n.consequent:n.alternate,r))});case"Identifier":return Promise.resolve(r[n.name]);case"Literal":return Promise.resolve(n.value);case"LogicalExpression":var m=function(e){return Promise.resolve(Promise.all([o(n.left,r),o(n.right,r)])).then(function(e){return c[n.operator](e[0],e[1])})},d=function(){if("||"===n.operator)return Promise.resolve(o(n.right,r)).then(function(){});var e=function(){if("&&"===n.operator)return Promise.resolve(o(n.right,r)).then(function(){})}();return e&&e.then?e.then(function(){}):void 0}();return Promise.resolve(d&&d.then?d.then(m):m());case"MemberExpression":return Promise.resolve(u(n,r)).then(function(e){return e[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var h=a[n.operator];return Promise.resolve(o(n.argument,r)).then(function(e){return h.call(a,e)});default:return Promise.resolve(void 0)}}catch(e){return Promise.reject(e)}},u=function(e,r){try{return Promise.resolve(o(e.object,r)).then(function(n){function t(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[n,n[u]]}var u,i=function(){if(e.computed)return Promise.resolve(o(e.property,r)).then(function(e){u=e});u=e.property.name}();return i&&i.then?i.then(t):t()})}catch(e){return Promise.reject(e)}},i=function(e,r){try{return Promise.resolve(Promise.all(e.map(function(e){return o(e,r)})))}catch(e){return Promise.reject(e)}},s={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},c={"||":function(e,r){return e||r},"&&":function(e,r){return e&&r},"|":function(e,r){return e|r},"^":function(e,r){return e^r},"&":function(e,r){return e&r},"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},"===":function(e,r){return e===r},"!==":function(e,r){return e!==r},"<":function(e,r){return e<r},">":function(e,r){return e>r},"<=":function(e,r){return e<=r},">=":function(e,r){return e>=r},"<<":function(e,r){return e<<r},">>":function(e,r){return e>>r},">>>":function(e,r){return e>>>r},"+":function(e,r){return e+r},"-":function(e,r){return e-r},"*":function(e,r){return e*r},"/":function(e,r){return e/r},"%":function(e,r){return e%r}},a={"-":function(e){return-e},"+":function(e){return+e},"~":function(e){return~e},"!":function(e){return!e}};function f(e,r){return e.map(function(e){return p(e,r)})}function l(e,r){var n,t=p(e.object,r);if(n=e.computed?p(e.property,r):e.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function p(e,r){var n=e;switch(n.type){case"ArrayExpression":return f(n.elements,r);case"BinaryExpression":return c[n.operator](p(n.left,r),p(n.right,r));case"CallExpression":var t,o,u;if("MemberExpression"===n.callee.type?(t=(u=l(n.callee,r))[0],o=u[1]):o=p(n.callee,r),"function"!=typeof o)return;return o.apply(t,f(n.arguments,r));case"ConditionalExpression":return p(n.test,r)?p(n.consequent,r):p(n.alternate,r);case"Identifier":return r[n.name];case"Literal":return n.value;case"LogicalExpression":return"||"===n.operator?p(n.left,r)||p(n.right,r):"&&"===n.operator?p(n.left,r)&&p(n.right,r):c[n.operator](p(n.left,r),p(n.right,r));case"MemberExpression":return l(n,r)[1];case"ThisExpression":return r;case"UnaryExpression":return a[n.operator](p(n.argument,r));default:return}}Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return t.default}}),e.addBinaryOp=function(e,r,n){n?(t.default.addBinaryOp(e,r),c[e]=n):(t.default.addBinaryOp(e,s[e]||1),c[e]=r)},e.addUnaryOp=function(e,r){t.default.addUnaryOp(e),a[e]=r},e.compile=function(e){return p.bind(null,t.default(e))},e.compileAsync=function(e){return o.bind(null,t.default(e))},e.eval=p,e.evalAsync=o});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("jsep")):"function"==typeof define&&define.amd?define(["exports","jsep"],r):r((e||self).expressionEval={},e.jsep)}(this,function(e,r){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=/*#__PURE__*/n(r),o=function(e,r){try{var n,t=e;switch(t.type){case"ArrayExpression":return Promise.resolve(i(t.elements,r));case"BinaryExpression":return Promise.resolve(Promise.all([o(t.left,r),o(t.right,r)])).then(function(e){return c[t.operator](e[0],e[1])});case"CallExpression":var s,f,l,p=function(){if("function"==typeof f){var e=f,n=e.apply,o=s;return Promise.resolve(i(t.arguments,r)).then(function(r){return Promise.resolve(n.call(e,o,r))})}},m="MemberExpression"===t.callee.type?Promise.resolve(u(t.callee,r)).then(function(e){s=(l=e)[0],f=l[1]}):Promise.resolve(o(t.callee,r)).then(function(e){f=e});return Promise.resolve(m&&m.then?m.then(p):p());case"ConditionalExpression":return Promise.resolve(o(t.test,r)).then(function(e){return Promise.resolve(o(e?t.consequent:t.alternate,r))});case"Identifier":return Promise.resolve(r[t.name]);case"Literal":return Promise.resolve(t.value);case"LogicalExpression":var d=function(e){return n?e:Promise.resolve(Promise.all([o(t.left,r),o(t.right,r)])).then(function(e){return c[t.operator](e[0],e[1])})},v="||"===t.operator?Promise.resolve(o(t.left,r)).then(function(e){return e?(n=1,e):Promise.resolve(o(t.right,r)).then(function(e){return n=1,e})}):function(){if("&&"===t.operator)return Promise.resolve(o(t.left,r)).then(function(e){return e?Promise.resolve(o(t.right,r)).then(function(e){return n=1,e}):(n=1,e)})}();return Promise.resolve(v&&v.then?v.then(d):d(v));case"MemberExpression":return Promise.resolve(u(t,r)).then(function(e){return e[1]});case"ThisExpression":return Promise.resolve(r);case"UnaryExpression":var h=a[t.operator];return Promise.resolve(o(t.argument,r)).then(function(e){return h.call(a,e)});default:return Promise.resolve(void 0)}}catch(e){return Promise.reject(e)}},u=function(e,r){try{return Promise.resolve(o(e.object,r)).then(function(n){function t(){if(/^__proto__|prototype|constructor$/.test(u))throw Error('Access to member "'+u+'" disallowed.');return[n,n[u]]}var u,i=function(){if(e.computed)return Promise.resolve(o(e.property,r)).then(function(e){u=e});u=e.property.name}();return i&&i.then?i.then(t):t()})}catch(e){return Promise.reject(e)}},i=function(e,r){try{return Promise.resolve(Promise.all(e.map(function(e){return o(e,r)})))}catch(e){return Promise.reject(e)}},s={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},c={"||":function(e,r){return e||r},"&&":function(e,r){return e&&r},"|":function(e,r){return e|r},"^":function(e,r){return e^r},"&":function(e,r){return e&r},"==":function(e,r){return e==r},"!=":function(e,r){return e!=r},"===":function(e,r){return e===r},"!==":function(e,r){return e!==r},"<":function(e,r){return e<r},">":function(e,r){return e>r},"<=":function(e,r){return e<=r},">=":function(e,r){return e>=r},"<<":function(e,r){return e<<r},">>":function(e,r){return e>>r},">>>":function(e,r){return e>>>r},"+":function(e,r){return e+r},"-":function(e,r){return e-r},"*":function(e,r){return e*r},"/":function(e,r){return e/r},"%":function(e,r){return e%r}},a={"-":function(e){return-e},"+":function(e){return+e},"~":function(e){return~e},"!":function(e){return!e}};function f(e,r){return e.map(function(e){return p(e,r)})}function l(e,r){var n,t=p(e.object,r);if(n=e.computed?p(e.property,r):e.property.name,/^__proto__|prototype|constructor$/.test(n))throw Error('Access to member "'+n+'" disallowed.');return[t,t[n]]}function p(e,r){var n=e;switch(n.type){case"ArrayExpression":return f(n.elements,r);case"BinaryExpression":return c[n.operator](p(n.left,r),p(n.right,r));case"CallExpression":var t,o,u;if("MemberExpression"===n.callee.type?(t=(u=l(n.callee,r))[0],o=u[1]):o=p(n.callee,r),"function"!=typeof o)return;return o.apply(t,f(n.arguments,r));case"ConditionalExpression":return p(n.test,r)?p(n.consequent,r):p(n.alternate,r);case"Identifier":return r[n.name];case"Literal":return n.value;case"LogicalExpression":var i=p(n.left,r);return"||"===n.operator&&i?i:"&&"!==n.operator||i?c[n.operator](i,p(n.right,r)):i;case"MemberExpression":return l(n,r)[1];case"ThisExpression":return r;case"UnaryExpression":return a[n.operator](p(n.argument,r));default:return}}Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return t.default}}),e.addBinaryOp=function(e,r,n){n?(t.default.addBinaryOp(e,r),c[e]=n):(t.default.addBinaryOp(e,s[e]||1),c[e]=r)},e.addUnaryOp=function(e,r){t.default.addUnaryOp(e),a[e]=r},e.compile=function(e){return p.bind(null,t.default(e))},e.compileAsync=function(e){return o.bind(null,t.default(e))},e.eval=p,e.evalAsync=o});
//# sourceMappingURL=expression-eval.umd.js.map
{
"name": "@casbin/expression-eval",
"version": "5.2.0",
"version": "5.3.0",
"description": "JavaScript expression parsing and evaluation.",

@@ -5,0 +5,0 @@ "source": "index.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc