@openmrs/esm-expression-evaluator 5.8.1-pre.2234
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +5 -0
- package/README.md +3 -0
- package/dist/openmrs-esm-expression-evaluator.js +2 -0
- package/dist/openmrs-esm-expression-evaluator.js.map +1 -0
- package/jest.config.js +9 -0
- package/package.json +56 -0
- package/src/evaluator.test.ts +194 -0
- package/src/evaluator.ts +755 -0
- package/src/index.ts +1 -0
- package/src/public.ts +13 -0
- package/tsconfig.json +27 -0
- package/webpack.config.js +42 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
asset openmrs-esm-expression-evaluator.js 28.3 KiB [emitted] [minimized] (name: main) 1 related asset
|
|
2
|
+
orphan modules 78.2 KiB [orphan] 8 modules
|
|
3
|
+
runtime modules 670 bytes 3 modules
|
|
4
|
+
./src/index.ts + 8 modules 78.2 KiB [built] [code generated]
|
|
5
|
+
webpack 5.88.0 compiled successfully in 7201 ms
|
package/README.md
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
System.register([],(function(e,t){return{execute:function(){e((()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{compile:()=>N,evaluate:()=>C,evaluateAsBoolean:()=>D,evaluateAsBooleanAsync:()=>P,evaluateAsNumber:()=>R,evaluateAsNumberAsync:()=>k,evaluateAsType:()=>I,evaluateAsTypeAsync:()=>S,evaluateAsync:()=>w});class r{static get version(){return"1.3.9"}static toString(){return"JavaScript Expression Parser (JSEP) v"+r.version}static addUnaryOp(e){return r.max_unop_len=Math.max(e.length,r.max_unop_len),r.unary_ops[e]=1,r}static addBinaryOp(e,t,n){return r.max_binop_len=Math.max(e.length,r.max_binop_len),r.binary_ops[e]=t,n?r.right_associative.add(e):r.right_associative.delete(e),r}static addIdentifierChar(e){return r.additional_identifier_chars.add(e),r}static addLiteral(e,t){return r.literals[e]=t,r}static removeUnaryOp(e){return delete r.unary_ops[e],e.length===r.max_unop_len&&(r.max_unop_len=r.getMaxKeyLen(r.unary_ops)),r}static removeAllUnaryOps(){return r.unary_ops={},r.max_unop_len=0,r}static removeIdentifierChar(e){return r.additional_identifier_chars.delete(e),r}static removeBinaryOp(e){return delete r.binary_ops[e],e.length===r.max_binop_len&&(r.max_binop_len=r.getMaxKeyLen(r.binary_ops)),r.right_associative.delete(e),r}static removeAllBinaryOps(){return r.binary_ops={},r.max_binop_len=0,r}static removeLiteral(e){return delete r.literals[e],r}static removeAllLiterals(){return r.literals={},r}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new r(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map((e=>e.length)))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return r.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!r.binary_ops[String.fromCharCode(e)]||r.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return r.isIdentifierStart(e)||r.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(r.hooks[e]){const n={context:this,node:t};return r.hooks.run(e,n),n.node}return t}searchHook(e){if(r.hooks[e]){const t={context:this};return r.hooks[e].find((function(e){return e.call(t.context,t),t.node})),t.node}}gobbleSpaces(){let e=this.code;for(;e===r.SPACE_CODE||e===r.TAB_CODE||e===r.LF_CODE||e===r.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:r.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,n,i=[];for(;this.index<this.expr.length;)if(t=this.code,t===r.SEMCOL_CODE||t===r.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())i.push(n);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,r.max_binop_len),t=e.length;for(;t>0;){if(r.binary_ops.hasOwnProperty(e)&&(!r.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,n,i,o,s,a,c,l;if(s=this.gobbleToken(),!s)return s;if(t=this.gobbleBinaryOp(),!t)return s;for(o={value:t,prec:r.binaryPrecedence(t),right_a:r.right_associative.has(t)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+t),i=[s,o,a];t=this.gobbleBinaryOp();){if(n=r.binaryPrecedence(t),0===n){this.index-=t.length;break}o={value:t,prec:n,right_a:r.right_associative.has(t)},l=t;const c=e=>o.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;i.length>2&&c(i[i.length-2]);)a=i.pop(),t=i.pop().value,s=i.pop(),e={type:r.BINARY_EXP,operator:t,left:s,right:a},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),i.push(o,e)}for(c=i.length-1,e=i[c];c>1;)e={type:r.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:e},c-=2;return e}gobbleToken(){let e,t,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,r.isDecimalDigit(e)||e===r.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===r.SQUOTE_CODE||e===r.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===r.OBRACK_CODE)i=this.gobbleArray();else{for(t=this.expr.substr(this.index,r.max_unop_len),n=t.length;n>0;){if(r.unary_ops.hasOwnProperty(t)&&(!r.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!r.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=n;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:r.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--n)}r.isIdentifierStart(e)?(i=this.gobbleIdentifier(),r.literals.hasOwnProperty(i.name)?i={type:r.LITERAL,value:r.literals[i.name],raw:i.name}:i.name===r.this_str&&(i={type:r.THIS_EXP})):e===r.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===r.PERIOD_CODE||t===r.OBRACK_CODE||t===r.OPAREN_CODE||t===r.QUMARK_CODE;){let n;if(t===r.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==r.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===r.OBRACK_CODE?((e={type:r.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),t=this.code,t!==r.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===r.OPAREN_CODE?e={type:r.CALL_EXP,arguments:this.gobbleArguments(r.CPAREN_CODE),callee:e}:(t===r.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:r.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,n="";for(;r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===r.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(n+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(n+=this.expr.charAt(this.index++));r.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);r.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return t=this.code,r.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(t===r.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===r.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:r.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let e="";const t=this.index,n=this.expr.charAt(this.index++);let i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:r.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(r.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,r.isIdentifierPart(e));)this.index++;return{type:r.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){const t=[];let n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===e){n=!0,this.index++,e===r.CPAREN_CODE&&i&&i>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(o===r.COMMA_CODE){if(this.index++,i++,i!==t.length)if(e===r.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===r.CBRACK_CODE)for(let e=t.length;e<i;e++)t.push(null)}else if(t.length!==i&&0!==i)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==r.COMPOUND||this.throwError("Expected comma"),t.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(r.CPAREN_CODE);if(this.code===r.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:r.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:r.ARRAY_EXP,elements:this.gobbleArguments(r.CBRACK_CODE)}}}const n=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this)}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}};Object.assign(r,{hooks:n,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach((e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)}))}}(r),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),r.max_unop_len=r.getMaxKeyLen(r.unary_ops),r.max_binop_len=r.getMaxKeyLen(r.binary_ops);const i=e=>new r(e).parse(),o=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(r).filter((e=>!o.includes(e)&&void 0===i[e])).forEach((e=>{i[e]=r[e]})),i.Jsep=r;var s={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}};i.plugins.register(s);const a="ArrowFunctionExpression";var c={name:"arrow",init(e){function t(r){r&&(Object.values(r).forEach((e=>{e&&"object"==typeof e&&t(e)})),"=>"===r.operator&&(r.type=a,r.params=r.left?[r.left]:null,r.body=r.right,r.params&&r.params[0].type===e.SEQUENCE_EXP&&(r.params=r.params[0].expressions),delete r.left,delete r.right,delete r.operator))}e.addBinaryOp("=>",.1,!0),e.hooks.add("gobble-expression",(function(t){if(this.gobbleSpaces(),this.code===e.OPAREN_CODE){const r=this.index;if(this.index++,this.gobbleSpaces(),this.code===e.CPAREN_CODE){this.index++;const e=this.gobbleBinaryOp();if("=>"===e){const r=this.gobbleBinaryExpression();return r||this.throwError("Expected expression after "+e),void(t.node={type:a,params:null,body:r})}}this.index=r}})),e.hooks.add("after-expression",(function(e){t(e.node)}))}},l={name:"new",init(e){e.addUnaryOp("new"),e.hooks.add("after-token",(function(t){const r=t.node;if(r&&"new"===r.operator){r.argument&&[e.CALL_EXP,e.MEMBER_EXP].includes(r.argument.type)||this.throwError("Expected new function()"),t.node=r.argument;let n=t.node;for(;n.type===e.MEMBER_EXP||n.type===e.CALL_EXP&&n.callee.type===e.MEMBER_EXP;)n=n.type===e.MEMBER_EXP?n.object:n.callee.object;n.type="NewExpression"}}))}},h={name:"numbers",init(e){function t(e){return"x"===e||"X"===e?(this.index+=2,[[48,57],[65,70],[97,102]]):"b"===e||"B"===e?(this.index+=2,[[48,49]]):"o"===e||"O"===e||e>="0"&&e<="7"?(this.index+=e<="7"?1:2,[[48,55]]):null}function r(e){return"x"===e||"X"===e?16:"b"===e||"B"===e?2:8}function n(e,t){return 95===e||t.some((([t,r])=>e>=t&&e<=r))}function i(t){const r=this.index;let n="";const i=()=>{for(;e.isDecimalDigit(this.code)||95===this.code;)95===this.code?this.index++:n+=this.expr.charAt(this.index++)};i(),this.code===e.PERIOD_CODE&&(n+=this.expr.charAt(this.index++),i());let o=this.char;"e"!==o&&"E"!==o||(n+=this.expr.charAt(this.index++),o=this.char,"+"!==o&&"-"!==o||(n+=this.expr.charAt(this.index++)),i(),e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")"));const s=this.code;if(e.isIdentifierStart(s))this.throwError("Variable names cannot start with a number ("+n+this.char+")");else if(s===e.PERIOD_CODE)return n.length>1&&this.throwError(`Unexpected period ${JSON.stringify({chCode:s,number:n},null,2)}`),void(this.index=r);t.node={type:e.LITERAL,value:parseFloat(n),raw:this.expr.substring(r,this.index)}}e.hooks.add("gobble-token",(function(o){if(48===this.code){const s=this.index,a=this.expr.charAt(this.index+1),c=t.call(this,a);if(!c)return;let l="";for(;n(this.code,c);)95===this.code?this.index++:l+=this.expr.charAt(this.index++);if(e.isIdentifierPart(this.code)){if(e.isDecimalDigit(this.code)&&e.isDecimalDigit(a.charCodeAt(0)))return this.index=s+1,void i.call(this,o);this.throwError("unexpected char within number")}o.node={type:e.LITERAL,value:parseInt(l,r(a)),raw:this.expr.substring(s,this.index)}}else(e.isDecimalDigit(this.code)||this.code===e.PERIOD_CODE)&&i.call(this,o)}))}},p={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let i,o="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;o+=this.char}try{i=new RegExp(n,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}},u={name:"ternary",init(e){e.hooks.add("after-expression",(function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}}))}},d={name:"jsepTemplateLiteral",init(e){function t(e,t=!0){if(96===this.code){const r={type:"TemplateLiteral",quasis:[],expressions:[]};let n="",i="",o=!1;const s=this.expr.length,a=()=>r.quasis.push({type:"TemplateElement",value:{raw:i,cooked:n},tail:o});for(;this.index<s;){let s=this.expr.charAt(++this.index);if("`"===s)return this.index+=1,o=!0,a(),e.node=r,t&&(e.node=this.gobbleTokenProperty(e.node)),e.node;if("$"===s&&"{"===this.expr.charAt(this.index+1))this.index+=2,a(),i="",n="",r.expressions.push(...this.gobbleExpressions(125)),125!==this.code&&this.throwError("unclosed ${");else if("\\"===s)switch(i+=s,s=this.expr.charAt(++this.index),i+=s,s){case"n":n+="\n";break;case"r":n+="\r";break;case"t":n+="\t";break;case"b":n+="\b";break;case"f":n+="\f";break;case"v":n+="\v";break;default:n+=s}else n+=s,i+=s}this.throwError("Unclosed `")}}e.hooks.add("gobble-token",t),e.hooks.add("after-token",(function(r){if((r.node.type===e.IDENTIFIER||r.node.type===e.MEMBER_EXP)&&96===this.code)return r.node={type:"TaggedTemplateExpression",tag:r.node,quasi:t.bind(this)(r,!1)},r.node=this.gobbleTokenProperty(r.node),r.node}))}};function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,i,o,s){try{var a=e[o](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function y(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function s(e){b(o,n,i,s,a,"next",e)}function a(e){b(o,n,i,s,a,"throw",e)}s(void 0)}))}}function x(e,t,r){return x=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&O(i,r.prototype),i},x.apply(null,arguments)}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){E(e,t,r[t])}))}return e}function O(e,t){return O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},O(e,t)}function v(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function C(e){return I(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},M)}function w(e){return A.apply(this,arguments)}function A(){return A=y((function(e){var t=arguments;return _(this,(function(r){return[2,S(e,t.length>1&&void 0!==t[1]?t[1]:{},M)]}))})),A.apply(this,arguments)}function D(e){return I(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},B)}function P(e){return S(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},B)}function R(e){return I(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},T)}function k(e){return I(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},T)}function I(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!("string"==typeof e||"object"==typeof e&&e&&"type"in e))throw"Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string.");null==t&&(t={});var n=function(e){return X(e,V)}(t),o=L("string"==typeof e?i(e):e,n);if(r(o))return o;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}function S(e){return j.apply(this,arguments)}function j(){return j=y((function(e){var t,r,n,o=arguments;return _(this,(function(s){return t=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2?o[2]:void 0,"string"==typeof e||"object"==typeof e&&e&&"type"in e?(null==t&&(t={}),n=function(e){return X(e,J)}(t),[2,Promise.resolve(L("string"==typeof e?i(e):e,n)).then((function(t){if(r(t))return t;throw{type:"Invalid result",message:"string"==typeof e?"The expression ".concat(e," did not produce a valid result"):"The expression did not produce a valid result"}}))]):[2,Promise.reject("Unknown expression type ".concat(e,". Expressions must either be a string or pre-compiled string."))]}))})),j.apply(this,arguments)}function N(e){return i(e)}function M(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e||g(e,Date)}function B(e){return"boolean"==typeof e}function T(e){return"number"==typeof e}function L(e,t){switch(e.type){case"UnaryExpression":return function(e,t){var r=L(e.argument,t);switch(e.operator){case"+":return+r;case"-":return-r;case"~":return~r;case"!":return!r;default:throw"Expression evaluator does not support operator '".concat(e.operator,"''")}}(e,t);case"BinaryExpression":return function(e,t){var r=L(e.left,t),n=L(e.right,t);switch(e.operator){case"+":return r+n;case"-":return r-n;case"*":return r*n;case"/":return r/n;case"%":return r%n;case"**":return Math.pow(r,n);case"==":return r==n;case"===":return r===n;case"!=":return r!=n;case"!==":return r!==n;case">":return r>n;case">=":return r>=n;case"<":return r<n;case"<=":return r<=n;case"in":return r in n;case"&&":return r&&n;case"||":return r||n;case"??":return null!=r?r:n;default:throw"Expression evaluator does not support operator '".concat(e.operator,"' operator")}}(e,t);case"ConditionalExpression":return function(e,t){var r=L(e.test,t);return L(r?e.consequent:e.alternate,t)}(e,t);case"CallExpression":return function(e,t){var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(K(t)),i=L(e.callee,t);if(!i)throw"No function named ".concat(e.callee," is defined in this context");if(!g(i,Function))throw"".concat(e.callee," is not a function");return i.apply(void 0,v(n))}(e,t);case"ArrowFunctionExpression":return function(e,t){var r,n,i,o=null!==(n=null===(r=e.params)||void 0===r?void 0:r.map((function(e){if("Identifier"===e.type)return e.name;throw"Cannot handle parameter of type ".concat(e.type)})))&&void 0!==n?n:[];return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];if(n.length<o.length)throw"Required argument(s) ".concat(o.slice(n.length,-1).join(", ")," were not provided");var s=Object.fromEntries(o.reduce((function(e,t,r){var i=n[r];return H(i)&&e.push([t,i]),e}),[]));return L(e.body,t.addVariables(s))}.bind(null!==(i=t.thisObj)&&void 0!==i?i:null)}(e,t);case"MemberExpression":return function(e,t){var r=L(e.object,t);if(void 0===r)switch(e.object.type){case"Identifier":var n=U(e.object,t);throw ReferenceError("ReferenceError: ".concat(n," is not defined"));case"MemberExpression":var i=U(e.property,t);throw TypeError("TypeError: cannot read properties of undefined (reading '".concat(i,"')"));default:throw"VisitMemberExpression does not support operator '".concat(e.object.type,"' type")}var o,s=r;if("string"==typeof r)s=String.prototype;else if("number"==typeof r)s=Number.prototype;else if("function"==typeof r);else if("object"!=typeof r)throw"VisitMemberExpression does not support member access on type ".concat(void 0===r?"undefined":function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(r));switch(t.thisObj=s,e.property.type){case"Identifier":case"MemberExpression":o=L(e.property,t);break;default:var a=L(e.property,t);if(void 0===a)throw{type:"Illegal property access",message:"No property was supplied to the property access"};F(a),o=r[a]}return"function"==typeof o?o.bind(r):o}(e,t);case"ArrayExpression":return function(e,t){var r;return null===(r=e.elements)||void 0===r?void 0:r.map(K(t))}(e,t);case"SequenceExpression":return function(e,t){var r=e.expressions.map(K(t));return r[r.length-1]}(e,t);case"NewExpression":return function(e,t){if(!e.callee||"Identifier"!==e.callee.type)throw e.callee?"new must be called with either Date or RegExp":'Could not handle "new" without a specified class';var r,n=null===(r=e.arguments)||void 0===r?void 0:r.map(K(t));switch(e.callee.name){case"Date":return x(Date,v(n));case"RegExp":return x(RegExp,v(n));default:throw"Cannot instantiate object of type ".concat(e.callee.name)}}(e,t);case"Literal":return function(e,t){return F(e.value),e.value}(e);case"Identifier":return function(e,t){F(e.name);var r=t.thisObj;if(r&&("object"==typeof r||"function"==typeof r)&&e.name in r){var n=r[e.name];return F(n),n}if(t.variables&&e.name in t.variables){var i=t.variables[e.name];return F(i),i}return e.name in t.globals?t.globals[e.name]:void 0}(e,t);case"TemplateLiteral":return function(e,t){var r,n,i,o,s=null!==(i=null===(r=e.expressions)||void 0===r?void 0:r.map(K(t)))&&void 0!==i?i:[],a=null!==(o=null===(n=e.quasis)||void 0===n?void 0:n.map(K(t)))&&void 0!==o?o:[];return a.filter((function(e){return!e.tail})).map((function(e){return e.value})).join("")+s.join("")+a.filter((function(e){return e.tail})).map((function(e){return e.value})).join("")}(e,t);case"TemplateElement":return function(e,t){return{value:e.cooked,tail:e.tail}}(e);default:throw"Expression evaluator does not support expression of type '".concat(e.type,"'")}}function U(e,t){switch(e.type){case"Literal":return e.value;case"Identifier":return e.name;case"MemberExpression":return U(e.property,t);default:throw"VisitExpressionName does not support expression of type '".concat(e.type,"'")}}function X(e,t){var r={thisObj:void 0,variables:m({},e),globals:m({},t),addVariables:function(e){return this.variables=m({},this.variables,e),this}};return r.addVariables.bind(r),r}function K(e){return function(t){return null===t?null:L(t,e)}}function F(e){if("__proto__"===e||"prototype"===e||"constructor"===e)throw{type:"Illegal property access",message:"Cannot access the ".concat(e," property of objects")}}function H(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e||"function"==typeof e||null===e||g(e,RegExp))return!0;if("object"==typeof e){var t=!0,r=!1,n=void 0;try{for(var i,o=Object.keys(e)[Symbol.iterator]();!(t=(i=o.next()).done);t=!0)if(!H(e[i.value]))return!1}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return!0}if(Array.isArray(e)){var s=!0,a=!1,c=void 0;try{for(var l,h=e[Symbol.iterator]();!(s=(l=h.next()).done);s=!0)if(!H(l.value))return!1}catch(e){a=!0,c=e}finally{try{s||null==h.return||h.return()}finally{if(a)throw c}}}return!1}i.plugins.register(c),i.plugins.register(l),i.plugins.register(h),i.plugins.register(p),i.plugins.register(u),i.plugins.register(d),i.addBinaryOp("in",7),i.addBinaryOp("??",1);var Q,q,V={Array,Boolean,Symbol,Infinity:1/0,NaN:NaN,Math,Number,BigInt,String,RegExp,JSON,isFinite,isNaN,parseFloat,parseInt,decodeURI,encodeURI,encodeURIComponent,Object:{__proto__:void 0,assign:Object.assign.bind(null),fromEntries:Object.fromEntries.bind(null),hasOwn:Object.hasOwn.bind(null),keys:Object.keys.bind(null),is:Object.is.bind(null),values:Object.values.bind(null)}},J=(Q=m({},V),q=null!=(q={Promise})?q:{},Object.getOwnPropertyDescriptors?Object.defineProperties(Q,Object.getOwnPropertyDescriptors(q)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(q)).forEach((function(e){Object.defineProperty(Q,e,Object.getOwnPropertyDescriptor(q,e))})),Q);return t})())}}}));
|
|
2
|
+
//# sourceMappingURL=openmrs-esm-expression-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openmrs-esm-expression-evaluator.js","mappings":"iFACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,6NC2F9D,MAAMC,EAIMC,qBAEV,MAAO,OACR,CAKAC,kBACC,MAAO,wCAA0CF,EAAKC,OACvD,CAQAC,kBAAkBC,GAGjB,OAFAH,EAAKI,aAAeC,KAAKC,IAAIH,EAAQI,OAAQP,EAAKI,cAClDJ,EAAKQ,UAAUL,GAAW,EACnBH,CACR,CASAE,mBAAmBC,EAASM,EAAYC,GASvC,OARAV,EAAKW,cAAgBN,KAAKC,IAAIH,EAAQI,OAAQP,EAAKW,eACnDX,EAAKY,WAAWT,GAAWM,EACvBC,EACHV,EAAKa,kBAAkBC,IAAIX,GAG3BH,EAAKa,kBAAkBE,OAAOZ,GAExBH,CACR,CAOAE,yBAAyBc,GAExB,OADAhB,EAAKiB,4BAA4BH,IAAIE,GAC9BhB,CACR,CAQAE,kBAAkBgB,EAAcC,GAE/B,OADAnB,EAAKoB,SAASF,GAAgBC,EACvBnB,CACR,CAOAE,qBAAqBC,GAKpB,cAJOH,EAAKQ,UAAUL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AM,GACvBvB,EAAKuB,YAAY,KAAM,GA8rBvB,I,IAAM8C,EAAU,CACd1E,MACAgI,QACAlR,OACAmR,SAAAA,IACAC,IAAAA,IACA5Q,KACAwP,OACAqB,OACA/O,OACA4J,OACAP,KACA2F,SACAC,MACAxJ,WACA8D,SACA2F,UACAC,UACAC,mBACAnS,OAAQ,CACNoS,eAAWzH,EACXb,OAAQ9J,OAAO8J,OAAOuD,KAAK,MAC3BsC,YAAa3P,OAAO2P,YAAYtC,KAAK,MACrCgF,OAAQrS,OAAOqS,OAAOhF,KAAK,MAC3B3K,KAAM1C,OAAO0C,KAAK2K,KAAK,MACvBiF,GAAItS,OAAOsS,GAAGjF,KAAK,MACnBjC,OAAQpL,OAAOoL,OAAOiC,KAAK,QAIzBoB,G,EAAe,KAChBJ,G,WAAAA,CACHM,U","sources":["webpack://@openmrs/esm-expression-evaluator/webpack/bootstrap","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/define property getters","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/hasOwnProperty shorthand","webpack://@openmrs/esm-expression-evaluator/webpack/runtime/make namespace object","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/jsep/dist/jsep.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/arrow/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/new/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/numbers/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/regex/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/ternary/dist/index.js","webpack://@openmrs/esm-expression-evaluator/../../../node_modules/@jsep-plugin/template/dist/index.js","webpack://@openmrs/esm-expression-evaluator/./src/evaluator.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @implements {IHooks}\n */\nclass Hooks {\n\t/**\n\t * @callback HookCallback\n\t * @this {*|Jsep} this\n\t * @param {Jsep} env\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given callback to the list of callbacks for the given hook.\n\t *\n\t * The callback will be invoked when the hook it is registered for is run.\n\t *\n\t * One callback function can be registered to multiple hooks and the same hook multiple times.\n\t *\n\t * @param {string|object} name The name of the hook, or an object of callbacks keyed by name\n\t * @param {HookCallback|boolean} callback The callback function which is given environment variables.\n\t * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)\n\t * @public\n\t */\n\tadd(name, callback, first) {\n\t\tif (typeof arguments[0] != 'string') {\n\t\t\t// Multiple hook callbacks, keyed by name\n\t\t\tfor (let name in arguments[0]) {\n\t\t\t\tthis.add(name, arguments[0][name], arguments[1]);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t(Array.isArray(name) ? name : [name]).forEach(function (name) {\n\t\t\t\tthis[name] = this[name] || [];\n\n\t\t\t\tif (callback) {\n\t\t\t\t\tthis[name][first ? 'unshift' : 'push'](callback);\n\t\t\t\t}\n\t\t\t}, this);\n\t\t}\n\t}\n\n\t/**\n\t * Runs a hook invoking all registered callbacks with the given environment variables.\n\t *\n\t * Callbacks will be invoked synchronously and in the order in which they were registered.\n\t *\n\t * @param {string} name The name of the hook.\n\t * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.\n\t * @public\n\t */\n\trun(name, env) {\n\t\tthis[name] = this[name] || [];\n\t\tthis[name].forEach(function (callback) {\n\t\t\tcallback.call(env && env.context ? env.context : env, env);\n\t\t});\n\t}\n}\n\n/**\n * @implements {IPlugins}\n */\nclass Plugins {\n\tconstructor(jsep) {\n\t\tthis.jsep = jsep;\n\t\tthis.registered = {};\n\t}\n\n\t/**\n\t * @callback PluginSetup\n\t * @this {Jsep} jsep\n\t * @returns: void\n\t */\n\t/**\n\t * Adds the given plugin(s) to the registry\n\t *\n\t * @param {object} plugins\n\t * @param {string} plugins.name The name of the plugin\n\t * @param {PluginSetup} plugins.init The init function\n\t * @public\n\t */\n\tregister(...plugins) {\n\t\tplugins.forEach((plugin) => {\n\t\t\tif (typeof plugin !== 'object' || !plugin.name || !plugin.init) {\n\t\t\t\tthrow new Error('Invalid JSEP plugin format');\n\t\t\t}\n\t\t\tif (this.registered[plugin.name]) {\n\t\t\t\t// already registered. Ignore.\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tplugin.init(this.jsep);\n\t\t\tthis.registered[plugin.name] = plugin;\n\t\t});\n\t}\n}\n\n// JavaScript Expression Parser (JSEP) 1.3.9\n\nclass Jsep {\n\t/**\n\t * @returns {string}\n\t */\n\tstatic get version() {\n\t\t// To be filled in by the template\n\t\treturn '1.3.9';\n\t}\n\n\t/**\n\t * @returns {string}\n\t */\n\tstatic toString() {\n\t\treturn 'JavaScript Expression Parser (JSEP) v' + Jsep.version;\n\t};\n\n\t// ==================== CONFIG ================================\n\t/**\n\t * @method addUnaryOp\n\t * @param {string} op_name The name of the unary op to add\n\t * @returns {Jsep}\n\t */\n\tstatic addUnaryOp(op_name) {\n\t\tJsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);\n\t\tJsep.unary_ops[op_name] = 1;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method jsep.addBinaryOp\n\t * @param {string} op_name The name of the binary op to add\n\t * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence\n\t * @param {boolean} [isRightAssociative=false] whether operator is right-associative\n\t * @returns {Jsep}\n\t */\n\tstatic addBinaryOp(op_name, precedence, isRightAssociative) {\n\t\tJsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);\n\t\tJsep.binary_ops[op_name] = precedence;\n\t\tif (isRightAssociative) {\n\t\t\tJsep.right_associative.add(op_name);\n\t\t}\n\t\telse {\n\t\t\tJsep.right_associative.delete(op_name);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addIdentifierChar\n\t * @param {string} char The additional character to treat as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic addIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.add(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method addLiteral\n\t * @param {string} literal_name The name of the literal to add\n\t * @param {*} literal_value The value of the literal\n\t * @returns {Jsep}\n\t */\n\tstatic addLiteral(literal_name, literal_value) {\n\t\tJsep.literals[literal_name] = literal_value;\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeUnaryOp\n\t * @param {string} op_name The name of the unary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeUnaryOp(op_name) {\n\t\tdelete Jsep.unary_ops[op_name];\n\t\tif (op_name.length === Jsep.max_unop_len) {\n\t\t\tJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\n\t\t}\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllUnaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllUnaryOps() {\n\t\tJsep.unary_ops = {};\n\t\tJsep.max_unop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeIdentifierChar\n\t * @param {string} char The additional character to stop treating as a valid part of an identifier\n\t * @returns {Jsep}\n\t */\n\tstatic removeIdentifierChar(char) {\n\t\tJsep.additional_identifier_chars.delete(char);\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeBinaryOp\n\t * @param {string} op_name The name of the binary op to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeBinaryOp(op_name) {\n\t\tdelete Jsep.binary_ops[op_name];\n\n\t\tif (op_name.length === Jsep.max_binop_len) {\n\t\t\tJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\t\t}\n\t\tJsep.right_associative.delete(op_name);\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllBinaryOps\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllBinaryOps() {\n\t\tJsep.binary_ops = {};\n\t\tJsep.max_binop_len = 0;\n\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeLiteral\n\t * @param {string} literal_name The name of the literal to remove\n\t * @returns {Jsep}\n\t */\n\tstatic removeLiteral(literal_name) {\n\t\tdelete Jsep.literals[literal_name];\n\t\treturn Jsep;\n\t}\n\n\t/**\n\t * @method removeAllLiterals\n\t * @returns {Jsep}\n\t */\n\tstatic removeAllLiterals() {\n\t\tJsep.literals = {};\n\n\t\treturn Jsep;\n\t}\n\t// ==================== END CONFIG ============================\n\n\n\t/**\n\t * @returns {string}\n\t */\n\tget char() {\n\t\treturn this.expr.charAt(this.index);\n\t}\n\n\t/**\n\t * @returns {number}\n\t */\n\tget code() {\n\t\treturn this.expr.charCodeAt(this.index);\n\t};\n\n\n\t/**\n\t * @param {string} expr a string with the passed in express\n\t * @returns Jsep\n\t */\n\tconstructor(expr) {\n\t\t// `index` stores the character number we are currently at\n\t\t// All of the gobbles below will modify `index` as we move along\n\t\tthis.expr = expr;\n\t\tthis.index = 0;\n\t}\n\n\t/**\n\t * static top-level parser\n\t * @returns {jsep.Expression}\n\t */\n\tstatic parse(expr) {\n\t\treturn (new Jsep(expr)).parse();\n\t}\n\n\t/**\n\t * Get the longest key length of any object\n\t * @param {object} obj\n\t * @returns {number}\n\t */\n\tstatic getMaxKeyLen(obj) {\n\t\treturn Math.max(0, ...Object.keys(obj).map(k => k.length));\n\t}\n\n\t/**\n\t * `ch` is a character code in the next three functions\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isDecimalDigit(ch) {\n\t\treturn (ch >= 48 && ch <= 57); // 0...9\n\t}\n\n\t/**\n\t * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.\n\t * @param {string} op_val\n\t * @returns {number}\n\t */\n\tstatic binaryPrecedence(op_val) {\n\t\treturn Jsep.binary_ops[op_val] || 0;\n\t}\n\n\t/**\n\t * Looks for start of identifier\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierStart(ch) {\n\t\treturn (ch >= 65 && ch <= 90) || // A...Z\n\t\t\t(ch >= 97 && ch <= 122) || // a...z\n\t\t\t(ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)]) || // any non-ASCII that is not an operator\n\t\t\t(Jsep.additional_identifier_chars.has(String.fromCharCode(ch))); // additional characters\n\t}\n\n\t/**\n\t * @param {number} ch\n\t * @returns {boolean}\n\t */\n\tstatic isIdentifierPart(ch) {\n\t\treturn Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);\n\t}\n\n\t/**\n\t * throw error at index of the expression\n\t * @param {string} message\n\t * @throws\n\t */\n\tthrowError(message) {\n\t\tconst error = new Error(message + ' at character ' + this.index);\n\t\terror.index = this.index;\n\t\terror.description = message;\n\t\tthrow error;\n\t}\n\n\t/**\n\t * Run a given hook\n\t * @param {string} name\n\t * @param {jsep.Expression|false} [node]\n\t * @returns {?jsep.Expression}\n\t */\n\trunHook(name, node) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this, node };\n\t\t\tJsep.hooks.run(name, env);\n\t\t\treturn env.node;\n\t\t}\n\t\treturn node;\n\t}\n\n\t/**\n\t * Runs a given hook until one returns a node\n\t * @param {string} name\n\t * @returns {?jsep.Expression}\n\t */\n\tsearchHook(name) {\n\t\tif (Jsep.hooks[name]) {\n\t\t\tconst env = { context: this };\n\t\t\tJsep.hooks[name].find(function (callback) {\n\t\t\t\tcallback.call(env.context, env);\n\t\t\t\treturn env.node;\n\t\t\t});\n\t\t\treturn env.node;\n\t\t}\n\t}\n\n\t/**\n\t * Push `index` up to the next non-space character\n\t */\n\tgobbleSpaces() {\n\t\tlet ch = this.code;\n\t\t// Whitespace\n\t\twhile (ch === Jsep.SPACE_CODE\n\t\t|| ch === Jsep.TAB_CODE\n\t\t|| ch === Jsep.LF_CODE\n\t\t|| ch === Jsep.CR_CODE) {\n\t\t\tch = this.expr.charCodeAt(++this.index);\n\t\t}\n\t\tthis.runHook('gobble-spaces');\n\t}\n\n\t/**\n\t * Top-level method to parse all expressions and returns compound or single node\n\t * @returns {jsep.Expression}\n\t */\n\tparse() {\n\t\tthis.runHook('before-all');\n\t\tconst nodes = this.gobbleExpressions();\n\n\t\t// If there's only one expression just try returning the expression\n\t\tconst node = nodes.length === 1\n\t\t ? nodes[0]\n\t\t\t: {\n\t\t\t\ttype: Jsep.COMPOUND,\n\t\t\t\tbody: nodes\n\t\t\t};\n\t\treturn this.runHook('after-all', node);\n\t}\n\n\t/**\n\t * top-level parser (but can be reused within as well)\n\t * @param {number} [untilICode]\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleExpressions(untilICode) {\n\t\tlet nodes = [], ch_i, node;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch_i = this.code;\n\n\t\t\t// Expressions can be separated by semicolons, commas, or just inferred without any\n\t\t\t// separators\n\t\t\tif (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {\n\t\t\t\tthis.index++; // ignore separators\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Try to gobble each expression individually\n\t\t\t\tif (node = this.gobbleExpression()) {\n\t\t\t\t\tnodes.push(node);\n\t\t\t\t\t// If we weren't able to find a binary expression and are out of room, then\n\t\t\t\t\t// the expression passed in probably has too much\n\t\t\t\t}\n\t\t\t\telse if (this.index < this.expr.length) {\n\t\t\t\t\tif (ch_i === untilICode) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn nodes;\n\t}\n\n\t/**\n\t * The main parsing function.\n\t * @returns {?jsep.Expression}\n\t */\n\tgobbleExpression() {\n\t\tconst node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();\n\t\tthis.gobbleSpaces();\n\n\t\treturn this.runHook('after-expression', node);\n\t}\n\n\t/**\n\t * Search for the operation portion of the string (e.g. `+`, `===`)\n\t * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)\n\t * and move down from 3 to 2 to 1 character until a matching binary operation is found\n\t * then, return that binary operation\n\t * @returns {string|boolean}\n\t */\n\tgobbleBinaryOp() {\n\t\tthis.gobbleSpaces();\n\t\tlet to_check = this.expr.substr(this.index, Jsep.max_binop_len);\n\t\tlet tc_len = to_check.length;\n\n\t\twhile (tc_len > 0) {\n\t\t\t// Don't accept a binary op when it is an identifier.\n\t\t\t// Binary ops that start with a identifier-valid character must be followed\n\t\t\t// by a non identifier-part valid character\n\t\t\tif (Jsep.binary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t)) {\n\t\t\t\tthis.index += tc_len;\n\t\t\t\treturn to_check;\n\t\t\t}\n\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This function is responsible for gobbling an individual expression,\n\t * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`\n\t * @returns {?jsep.BinaryExpression}\n\t */\n\tgobbleBinaryExpression() {\n\t\tlet node, biop, prec, stack, biop_info, left, right, i, cur_biop;\n\n\t\t// First, try to get the leftmost thing\n\t\t// Then, check to see if there's a binary operator operating on that leftmost thing\n\t\t// Don't gobbleBinaryOp without a left-hand-side\n\t\tleft = this.gobbleToken();\n\t\tif (!left) {\n\t\t\treturn left;\n\t\t}\n\t\tbiop = this.gobbleBinaryOp();\n\n\t\t// If there wasn't a binary operator, just return the leftmost node\n\t\tif (!biop) {\n\t\t\treturn left;\n\t\t}\n\n\t\t// Otherwise, we need to start a stack to properly place the binary operations in their\n\t\t// precedence structure\n\t\tbiop_info = { value: biop, prec: Jsep.binaryPrecedence(biop), right_a: Jsep.right_associative.has(biop) };\n\n\t\tright = this.gobbleToken();\n\n\t\tif (!right) {\n\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t}\n\n\t\tstack = [left, biop_info, right];\n\n\t\t// Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)\n\t\twhile ((biop = this.gobbleBinaryOp())) {\n\t\t\tprec = Jsep.binaryPrecedence(biop);\n\n\t\t\tif (prec === 0) {\n\t\t\t\tthis.index -= biop.length;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tbiop_info = { value: biop, prec, right_a: Jsep.right_associative.has(biop) };\n\n\t\t\tcur_biop = biop;\n\n\t\t\t// Reduce: make a binary expression from the three topmost entries.\n\t\t\tconst comparePrev = prev => biop_info.right_a && prev.right_a\n\t\t\t\t? prec > prev.prec\n\t\t\t\t: prec <= prev.prec;\n\t\t\twhile ((stack.length > 2) && comparePrev(stack[stack.length - 2])) {\n\t\t\t\tright = stack.pop();\n\t\t\t\tbiop = stack.pop().value;\n\t\t\t\tleft = stack.pop();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\t\toperator: biop,\n\t\t\t\t\tleft,\n\t\t\t\t\tright\n\t\t\t\t};\n\t\t\t\tstack.push(node);\n\t\t\t}\n\n\t\t\tnode = this.gobbleToken();\n\n\t\t\tif (!node) {\n\t\t\t\tthis.throwError(\"Expected expression after \" + cur_biop);\n\t\t\t}\n\n\t\t\tstack.push(biop_info, node);\n\t\t}\n\n\t\ti = stack.length - 1;\n\t\tnode = stack[i];\n\n\t\twhile (i > 1) {\n\t\t\tnode = {\n\t\t\t\ttype: Jsep.BINARY_EXP,\n\t\t\t\toperator: stack[i - 1].value,\n\t\t\t\tleft: stack[i - 2],\n\t\t\t\tright: node\n\t\t\t};\n\t\t\ti -= 2;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * An individual part of a binary expression:\n\t * e.g. `foo.bar(baz)`, `1`, `\"abc\"`, `(a % 2)` (because it's in parenthesis)\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleToken() {\n\t\tlet ch, to_check, tc_len, node;\n\n\t\tthis.gobbleSpaces();\n\t\tnode = this.searchHook('gobble-token');\n\t\tif (node) {\n\t\t\treturn this.runHook('after-token', node);\n\t\t}\n\n\t\tch = this.code;\n\n\t\tif (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {\n\t\t\t// Char code 46 is a dot `.` which can start off a numeric literal\n\t\t\treturn this.gobbleNumericLiteral();\n\t\t}\n\n\t\tif (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {\n\t\t\t// Single or double quotes\n\t\t\tnode = this.gobbleStringLiteral();\n\t\t}\n\t\telse if (ch === Jsep.OBRACK_CODE) {\n\t\t\tnode = this.gobbleArray();\n\t\t}\n\t\telse {\n\t\t\tto_check = this.expr.substr(this.index, Jsep.max_unop_len);\n\t\t\ttc_len = to_check.length;\n\n\t\t\twhile (tc_len > 0) {\n\t\t\t\t// Don't accept an unary op when it is an identifier.\n\t\t\t\t// Unary ops that start with a identifier-valid character must be followed\n\t\t\t\t// by a non identifier-part valid character\n\t\t\t\tif (Jsep.unary_ops.hasOwnProperty(to_check) && (\n\t\t\t\t\t!Jsep.isIdentifierStart(this.code) ||\n\t\t\t\t\t(this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))\n\t\t\t\t)) {\n\t\t\t\t\tthis.index += tc_len;\n\t\t\t\t\tconst argument = this.gobbleToken();\n\t\t\t\t\tif (!argument) {\n\t\t\t\t\t\tthis.throwError('missing unaryOp argument');\n\t\t\t\t\t}\n\t\t\t\t\treturn this.runHook('after-token', {\n\t\t\t\t\t\ttype: Jsep.UNARY_EXP,\n\t\t\t\t\t\toperator: to_check,\n\t\t\t\t\t\targument,\n\t\t\t\t\t\tprefix: true\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tto_check = to_check.substr(0, --tc_len);\n\t\t\t}\n\n\t\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\t\tnode = this.gobbleIdentifier();\n\t\t\t\tif (Jsep.literals.hasOwnProperty(node.name)) {\n\t\t\t\t\tnode = {\n\t\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\t\tvalue: Jsep.literals[node.name],\n\t\t\t\t\t\traw: node.name,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse if (node.name === Jsep.this_str) {\n\t\t\t\t\tnode = { type: Jsep.THIS_EXP };\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) { // open parenthesis\n\t\t\t\tnode = this.gobbleGroup();\n\t\t\t}\n\t\t}\n\n\t\tif (!node) {\n\t\t\treturn this.runHook('after-token', false);\n\t\t}\n\n\t\tnode = this.gobbleTokenProperty(node);\n\t\treturn this.runHook('after-token', node);\n\t}\n\n\t/**\n\t * Gobble properties of of identifiers/strings/arrays/groups.\n\t * e.g. `foo`, `bar.baz`, `foo['bar'].baz`\n\t * It also gobbles function calls:\n\t * e.g. `Math.acos(obj.angle)`\n\t * @param {jsep.Expression} node\n\t * @returns {jsep.Expression}\n\t */\n\tgobbleTokenProperty(node) {\n\t\tthis.gobbleSpaces();\n\n\t\tlet ch = this.code;\n\t\twhile (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {\n\t\t\tlet optional;\n\t\t\tif (ch === Jsep.QUMARK_CODE) {\n\t\t\t\tif (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\toptional = true;\n\t\t\t\tthis.index += 2;\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t}\n\t\t\tthis.index++;\n\n\t\t\tif (ch === Jsep.OBRACK_CODE) {\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: true,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleExpression()\n\t\t\t\t};\n\t\t\t\tif (!node.property) {\n\t\t\t\t\tthis.throwError('Unexpected \"' + this.char + '\"');\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tch = this.code;\n\t\t\t\tif (ch !== Jsep.CBRACK_CODE) {\n\t\t\t\t\tthis.throwError('Unclosed [');\n\t\t\t\t}\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse if (ch === Jsep.OPAREN_CODE) {\n\t\t\t\t// A function call is being made; gobble all the arguments\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.CALL_EXP,\n\t\t\t\t\t'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),\n\t\t\t\t\tcallee: node\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (ch === Jsep.PERIOD_CODE || optional) {\n\t\t\t\tif (optional) {\n\t\t\t\t\tthis.index--;\n\t\t\t\t}\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tnode = {\n\t\t\t\t\ttype: Jsep.MEMBER_EXP,\n\t\t\t\t\tcomputed: false,\n\t\t\t\t\tobject: node,\n\t\t\t\t\tproperty: this.gobbleIdentifier(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (optional) {\n\t\t\t\tnode.optional = true;\n\t\t\t} // else leave undefined for compatibility with esprima\n\n\t\t\tthis.gobbleSpaces();\n\t\t\tch = this.code;\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to\n\t * keep track of everything in the numeric literal and then calling `parseFloat` on that string\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleNumericLiteral() {\n\t\tlet number = '', ch, chCode;\n\n\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t}\n\n\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) {\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\t\t}\n\n\t\tch = this.char;\n\n\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\tch = this.char;\n\n\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\twhile (Jsep.isDecimalDigit(this.code)) { // exponent itself\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t}\n\n\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t}\n\t\t}\n\n\t\tchCode = this.code;\n\n\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\tnumber + this.char + ')');\n\t\t}\n\t\telse if (chCode === Jsep.PERIOD_CODE || (number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE)) {\n\t\t\tthis.throwError('Unexpected period');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: parseFloat(number),\n\t\t\traw: number\n\t\t};\n\t}\n\n\t/**\n\t * Parses a string literal, staring with single or double quotes with basic support for escape codes\n\t * e.g. `\"hello world\"`, `'this is\\nJSEP'`\n\t * @returns {jsep.Literal}\n\t */\n\tgobbleStringLiteral() {\n\t\tlet str = '';\n\t\tconst startIndex = this.index;\n\t\tconst quote = this.expr.charAt(this.index++);\n\t\tlet closed = false;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tlet ch = this.expr.charAt(this.index++);\n\n\t\t\tif (ch === quote) {\n\t\t\t\tclosed = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch === '\\\\') {\n\t\t\t\t// Check for all of the common escape codes\n\t\t\t\tch = this.expr.charAt(this.index++);\n\n\t\t\t\tswitch (ch) {\n\t\t\t\t\tcase 'n': str += '\\n'; break;\n\t\t\t\t\tcase 'r': str += '\\r'; break;\n\t\t\t\t\tcase 't': str += '\\t'; break;\n\t\t\t\t\tcase 'b': str += '\\b'; break;\n\t\t\t\t\tcase 'f': str += '\\f'; break;\n\t\t\t\t\tcase 'v': str += '\\x0B'; break;\n\t\t\t\t\tdefault : str += ch;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstr += ch;\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Unclosed quote after \"' + str + '\"');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: Jsep.LITERAL,\n\t\t\tvalue: str,\n\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles only identifiers\n\t * e.g.: `foo`, `_value`, `$x1`\n\t * Also, this function checks if that identifier is a literal:\n\t * (e.g. `true`, `false`, `null`) or `this`\n\t * @returns {jsep.Identifier}\n\t */\n\tgobbleIdentifier() {\n\t\tlet ch = this.code, start = this.index;\n\n\t\tif (Jsep.isIdentifierStart(ch)) {\n\t\t\tthis.index++;\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unexpected ' + this.char);\n\t\t}\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tch = this.code;\n\n\t\t\tif (Jsep.isIdentifierPart(ch)) {\n\t\t\t\tthis.index++;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\ttype: Jsep.IDENTIFIER,\n\t\t\tname: this.expr.slice(start, this.index),\n\t\t};\n\t}\n\n\t/**\n\t * Gobbles a list of arguments within the context of a function call\n\t * or array literal. This function also assumes that the opening character\n\t * `(` or `[` has already been gobbled, and gobbles expressions and commas\n\t * until the terminator character `)` or `]` is encountered.\n\t * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`\n\t * @param {number} termination\n\t * @returns {jsep.Expression[]}\n\t */\n\tgobbleArguments(termination) {\n\t\tconst args = [];\n\t\tlet closed = false;\n\t\tlet separator_count = 0;\n\n\t\twhile (this.index < this.expr.length) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tlet ch_i = this.code;\n\n\t\t\tif (ch_i === termination) { // done parsing\n\t\t\t\tclosed = true;\n\t\t\t\tthis.index++;\n\n\t\t\t\tif (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length){\n\t\t\t\t\tthis.throwError('Unexpected token ' + String.fromCharCode(termination));\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\telse if (ch_i === Jsep.COMMA_CODE) { // between expressions\n\t\t\t\tthis.index++;\n\t\t\t\tseparator_count++;\n\n\t\t\t\tif (separator_count !== args.length) { // missing argument\n\t\t\t\t\tif (termination === Jsep.CPAREN_CODE) {\n\t\t\t\t\t\tthis.throwError('Unexpected token ,');\n\t\t\t\t\t}\n\t\t\t\t\telse if (termination === Jsep.CBRACK_CODE) {\n\t\t\t\t\t\tfor (let arg = args.length; arg < separator_count; arg++) {\n\t\t\t\t\t\t\targs.push(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (args.length !== separator_count && separator_count !== 0) {\n\t\t\t\t// NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments\n\t\t\t\tthis.throwError('Expected comma');\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst node = this.gobbleExpression();\n\n\t\t\t\tif (!node || node.type === Jsep.COMPOUND) {\n\t\t\t\t\tthis.throwError('Expected comma');\n\t\t\t\t}\n\n\t\t\t\targs.push(node);\n\t\t\t}\n\t\t}\n\n\t\tif (!closed) {\n\t\t\tthis.throwError('Expected ' + String.fromCharCode(termination));\n\t\t}\n\n\t\treturn args;\n\t}\n\n\t/**\n\t * Responsible for parsing a group of things within parentheses `()`\n\t * that have no identifier in front (so not a function call)\n\t * This function assumes that it needs to gobble the opening parenthesis\n\t * and then tries to gobble everything within that parenthesis, assuming\n\t * that the next thing it should see is the close parenthesis. If not,\n\t * then the expression probably doesn't have a `)`\n\t * @returns {boolean|jsep.Expression}\n\t */\n\tgobbleGroup() {\n\t\tthis.index++;\n\t\tlet nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);\n\t\tif (this.code === Jsep.CPAREN_CODE) {\n\t\t\tthis.index++;\n\t\t\tif (nodes.length === 1) {\n\t\t\t\treturn nodes[0];\n\t\t\t}\n\t\t\telse if (!nodes.length) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn {\n\t\t\t\t\ttype: Jsep.SEQUENCE_EXP,\n\t\t\t\t\texpressions: nodes,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.throwError('Unclosed (');\n\t\t}\n\t}\n\n\t/**\n\t * Responsible for parsing Array literals `[1, 2, 3]`\n\t * This function assumes that it needs to gobble the opening bracket\n\t * and then tries to gobble the expressions as arguments.\n\t * @returns {jsep.ArrayExpression}\n\t */\n\tgobbleArray() {\n\t\tthis.index++;\n\n\t\treturn {\n\t\t\ttype: Jsep.ARRAY_EXP,\n\t\t\telements: this.gobbleArguments(Jsep.CBRACK_CODE)\n\t\t};\n\t}\n}\n\n// Static fields:\nconst hooks = new Hooks();\nObject.assign(Jsep, {\n\thooks,\n\tplugins: new Plugins(Jsep),\n\n\t// Node Types\n\t// ----------\n\t// This is the full set of types that any JSEP node can be.\n\t// Store them here to save space when minified\n\tCOMPOUND: 'Compound',\n\tSEQUENCE_EXP: 'SequenceExpression',\n\tIDENTIFIER: 'Identifier',\n\tMEMBER_EXP: 'MemberExpression',\n\tLITERAL: 'Literal',\n\tTHIS_EXP: 'ThisExpression',\n\tCALL_EXP: 'CallExpression',\n\tUNARY_EXP: 'UnaryExpression',\n\tBINARY_EXP: 'BinaryExpression',\n\tARRAY_EXP: 'ArrayExpression',\n\n\tTAB_CODE: 9,\n\tLF_CODE: 10,\n\tCR_CODE: 13,\n\tSPACE_CODE: 32,\n\tPERIOD_CODE: 46, // '.'\n\tCOMMA_CODE: 44, // ','\n\tSQUOTE_CODE: 39, // single quote\n\tDQUOTE_CODE: 34, // double quotes\n\tOPAREN_CODE: 40, // (\n\tCPAREN_CODE: 41, // )\n\tOBRACK_CODE: 91, // [\n\tCBRACK_CODE: 93, // ]\n\tQUMARK_CODE: 63, // ?\n\tSEMCOL_CODE: 59, // ;\n\tCOLON_CODE: 58, // :\n\n\n\t// Operations\n\t// ----------\n\t// Use a quickly-accessible map to store all of the unary operators\n\t// Values are set to `1` (it really doesn't matter)\n\tunary_ops: {\n\t\t'-': 1,\n\t\t'!': 1,\n\t\t'~': 1,\n\t\t'+': 1\n\t},\n\n\t// Also use a map for the binary operations but set their values to their\n\t// binary precedence for quick reference (higher number = higher precedence)\n\t// see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)\n\tbinary_ops: {\n\t\t'||': 1, '&&': 2, '|': 3, '^': 4, '&': 5,\n\t\t'==': 6, '!=': 6, '===': 6, '!==': 6,\n\t\t'<': 7, '>': 7, '<=': 7, '>=': 7,\n\t\t'<<': 8, '>>': 8, '>>>': 8,\n\t\t'+': 9, '-': 9,\n\t\t'*': 10, '/': 10, '%': 10\n\t},\n\n\t// sets specific binary_ops as right-associative\n\tright_associative: new Set(),\n\n\t// Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)\n\tadditional_identifier_chars: new Set(['$', '_']),\n\n\t// Literals\n\t// ----------\n\t// Store the values to return for the various literals we may encounter\n\tliterals: {\n\t\t'true': true,\n\t\t'false': false,\n\t\t'null': null\n\t},\n\n\t// Except for `this`, which is special. This could be changed to something like `'self'` as well\n\tthis_str: 'this',\n});\nJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\nJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\n// Backward Compatibility:\nconst jsep = expr => (new Jsep(expr)).parse();\nconst stdClassProps = Object.getOwnPropertyNames(class Test{});\nObject.getOwnPropertyNames(Jsep)\n\t.filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined)\n\t.forEach((m) => {\n\t\tjsep[m] = Jsep[m];\n\t});\njsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');\n\nconst CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar ternary = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\n// Add default plugins:\n\njsep.plugins.register(ternary);\n\nexport { Jsep, jsep as default };\n","const ARROW_EXP = 'ArrowFunctionExpression';\n\nvar index = {\n\tname: 'arrow',\n\n\tinit(jsep) {\n\t\t// arrow-function expressions: () => x, v => v, (a, b) => v\n\t\tjsep.addBinaryOp('=>', 0.1, true);\n\n\t\t// this hook searches for the special case () => ...\n\t\t// which would normally throw an error because of the invalid LHS to the bin op\n\t\tjsep.hooks.add('gobble-expression', function gobbleEmptyArrowArg(env) {\n\t\t\tthis.gobbleSpaces();\n\t\t\tif (this.code === jsep.OPAREN_CODE) {\n\t\t\t\tconst backupIndex = this.index;\n\t\t\t\tthis.index++;\n\n\t\t\t\tthis.gobbleSpaces();\n\t\t\t\tif (this.code === jsep.CPAREN_CODE) {\n\t\t\t\t\tthis.index++;\n\n\t\t\t\t\tconst biop = this.gobbleBinaryOp();\n\t\t\t\t\tif (biop === '=>') {\n\t\t\t\t\t\t// () => ...\n\t\t\t\t\t\tconst body = this.gobbleBinaryExpression();\n\t\t\t\t\t\tif (!body) {\n\t\t\t\t\t\t\tthis.throwError(\"Expected expression after \" + biop);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: ARROW_EXP,\n\t\t\t\t\t\t\tparams: null,\n\t\t\t\t\t\t\tbody,\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.index = backupIndex;\n\t\t\t}\n\t\t});\n\n\t\tjsep.hooks.add('after-expression', function fixBinaryArrow(env) {\n\t\t\tupdateBinariesToArrows(env.node);\n\t\t});\n\n\t\tfunction updateBinariesToArrows(node) {\n\t\t\tif (node) {\n\t\t\t\t// Traverse full tree, converting any sub-object nodes as needed\n\t\t\t\tObject.values(node).forEach((val) => {\n\t\t\t\t\tif (val && typeof val === 'object') {\n\t\t\t\t\t\tupdateBinariesToArrows(val);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (node.operator === '=>') {\n\t\t\t\t\tnode.type = ARROW_EXP;\n\t\t\t\t\tnode.params = node.left ? [node.left] : null;\n\t\t\t\t\tnode.body = node.right;\n\t\t\t\t\tif (node.params && node.params[0].type === jsep.SEQUENCE_EXP) {\n\t\t\t\t\t\tnode.params = node.params[0].expressions;\n\t\t\t\t\t}\n\t\t\t\t\tdelete node.left;\n\t\t\t\t\tdelete node.right;\n\t\t\t\t\tdelete node.operator;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexport { index as default };\n","var index = {\n\tname: 'new',\n\n\tinit(jsep) {\n\t\tjsep.addUnaryOp('new');\n\n\t\tjsep.hooks.add('after-token', function gobbleNew(env) {\n\t\t\tconst node = env.node;\n\t\t\tif (node && node.operator === 'new') {\n\t\t\t\tif (!node.argument || ![jsep.CALL_EXP, jsep.MEMBER_EXP].includes(node.argument.type)) {\n\t\t\t\t\tthis.throwError('Expected new function()');\n\t\t\t\t}\n\t\t\t\tenv.node = node.argument;\n\n\t\t\t\t// Change CALL_EXP to NewExpression (could be a nested member, even within a call expr)\n\t\t\t\tlet callNode = env.node;\n\t\t\t\twhile (callNode.type === jsep.MEMBER_EXP || (\n\t\t\t\t\tcallNode.type === jsep.CALL_EXP && callNode.callee.type === jsep.MEMBER_EXP)) {\n\t\t\t\t\tcallNode = callNode.type === jsep.MEMBER_EXP\n\t\t\t\t\t\t? callNode.object\n\t\t\t\t\t\t: callNode.callee.object;\n\t\t\t\t}\n\t\t\t\tcallNode.type = 'NewExpression';\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","const NUM_0_CODE = 48;\nconst UNDERSCORE = 95;\n\nvar index = {\n\tname: 'numbers',\n\n\tinit(Jsep) {\n\t\tJsep.hooks.add('gobble-token', function gobbleNumber(env) {\n\t\t\tif (this.code === NUM_0_CODE) {\n\t\t\t\tconst startIndex = this.index;\n\t\t\t\tconst numType = this.expr.charAt(this.index + 1);\n\t\t\t\tconst ranges = getNumberCodeRanges.call(this, numType);\n\t\t\t\tif (!ranges) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tlet number = '';\n\t\t\t\twhile (isUnderscoreOrWithinRange(this.code, ranges)) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index ++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// confirm valid syntax after building number string within ranges\n\t\t\t\tif (Jsep.isIdentifierPart(this.code)) {\n\t\t\t\t\tif (Jsep.isDecimalDigit(this.code) && Jsep.isDecimalDigit(numType.charCodeAt(0))) {\n\t\t\t\t\t\t// abort octal processing and reset to ignore the leading 0\n\t\t\t\t\t\tthis.index = startIndex + 1;\n\t\t\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.throwError('unexpected char within number');\n\t\t\t\t}\n\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\t\tvalue: parseInt(number, getNumberBase(numType)),\n\t\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t\t};\n\t\t\t}\n\t\t\telse if (Jsep.isDecimalDigit(this.code) || this.code === Jsep.PERIOD_CODE) {\n\t\t\t\tgobbleBase10.call(this, env);\n\t\t\t}\n\t\t});\n\n\t\t/**\n\t\t * Gets the range of allowable number codes (decimal) and updates index\n\t\t * @param {string} numType\n\t\t * @returns {number[][]|null}\n\t\t */\n\t\tfunction getNumberCodeRanges(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [\n\t\t\t\t\t[48, 57], // 0-9\n\t\t\t\t\t[65, 70], // A-F\n\t\t\t\t\t[97, 102], // a-f\n\t\t\t\t];\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\tthis.index += 2;\n\t\t\t\treturn [[48, 49]]; // 0-1\n\t\t\t}\n\t\t\telse if (numType === 'o' || numType === 'O' ||\n\t\t\t\t(numType >= '0' && numType <= '7')) { // 0-7 allows non-standard 0644 = 420\n\t\t\t\tthis.index += numType <= '7' ? 1 : 2;\n\t\t\t\treturn [[48, 55]]; // 0-7\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\t/**\n\t\t * Supports Hex, Octal and Binary only\n\t\t * @param {string} numType\n\t\t * @returns {16|8|2}\n\t\t */\n\t\tfunction getNumberBase(numType) {\n\t\t\tif (numType === 'x' || numType === 'X') {\n\t\t\t\treturn 16;\n\t\t\t}\n\t\t\telse if (numType === 'b' || numType === 'B') {\n\t\t\t\treturn 2;\n\t\t\t}\n\t\t\t// default (includes non-stand 044)\n\t\t\treturn 8;\n\t\t}\n\n\t\t/**\n\t\t * Verifies number code is within given ranges\n\t\t * @param {number} code\n\t\t * @param {number[][]} ranges\n\t\t */\n\t\tfunction isUnderscoreOrWithinRange(code, ranges) {\n\t\t\treturn code === UNDERSCORE ||\n\t\t\t\tranges.some(([min, max]) => code >= min && code <= max);\n\t\t}\n\n\t\t/**\n\t\t * Same as core gobbleNumericLiteral, but allows for _ char\n\t\t * @param {{ context?: typeof Jsep, node?: Expression }} env\n\t\t */\n\t\tfunction gobbleBase10(env) {\n\t\t\tconst startIndex = this.index;\n\t\t\tlet number = '';\n\n\t\t\tconst gobbleDigits = () => {\n\t\t\t\twhile (Jsep.isDecimalDigit(this.code) || this.code === UNDERSCORE) {\n\t\t\t\t\tif (this.code === UNDERSCORE) {\n\t\t\t\t\t\tthis.index++;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tgobbleDigits();\n\t\t\tif (this.code === Jsep.PERIOD_CODE) { // can start with a decimal marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\n\t\t\t\tgobbleDigits();\n\t\t\t}\n\n\t\t\tlet ch = this.char;\n\t\t\tif (ch === 'e' || ch === 'E') { // exponent marker\n\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\tch = this.char;\n\n\t\t\t\tif (ch === '+' || ch === '-') { // exponent sign\n\t\t\t\t\tnumber += this.expr.charAt(this.index++);\n\t\t\t\t}\n\n\t\t\t\tgobbleDigits(); // exponent itself\n\n\t\t\t\tif (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) ) {\n\t\t\t\t\tthis.throwError('Expected exponent (' + number + this.char + ')');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst chCode = this.code;\n\n\t\t\t// Check to make sure this isn't a variable name that start with a number (123abc)\n\t\t\tif (Jsep.isIdentifierStart(chCode)) {\n\t\t\t\tthis.throwError('Variable names cannot start with a number (' +\n\t\t\t\t\tnumber + this.char + ')');\n\t\t\t}\n\t\t\telse if (chCode === Jsep.PERIOD_CODE) {\n\t\t\t\tif (number.length > 1) {\n\t\t\t\t\tthis.throwError(`Unexpected period ${JSON.stringify({ chCode, number }, null, 2)}`);\n\t\t\t\t}\n\t\t\t\t// leave other error-handling to jsep core. Also allows spread operator.\n\t\t\t\tthis.index = startIndex;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tenv.node = {\n\t\t\t\ttype: Jsep.LITERAL,\n\t\t\t\tvalue: parseFloat(number),\n\t\t\t\traw: this.expr.substring(startIndex, this.index),\n\t\t\t};\n\t\t}\n\t}\n};\n\nexport { index as default };\n","const FSLASH_CODE = 47; // '/'\nconst BSLASH_CODE = 92; // '\\\\'\n\nvar index = {\n\tname: 'regex',\n\n\tinit(jsep) {\n\t\t// Regex literal: /abc123/ig\n\t\tjsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {\n\t\t\tif (this.code === FSLASH_CODE) {\n\t\t\t\tconst patternIndex = ++this.index;\n\n\t\t\t\tlet inCharSet = false;\n\t\t\t\twhile (this.index < this.expr.length) {\n\t\t\t\t\tif (this.code === FSLASH_CODE && !inCharSet) {\n\t\t\t\t\t\tconst pattern = this.expr.slice(patternIndex, this.index);\n\n\t\t\t\t\t\tlet flags = '';\n\t\t\t\t\t\twhile (++this.index < this.expr.length) {\n\t\t\t\t\t\t\tconst code = this.code;\n\t\t\t\t\t\t\tif ((code >= 97 && code <= 122) // a...z\n\t\t\t\t\t\t\t\t|| (code >= 65 && code <= 90) // A...Z\n\t\t\t\t\t\t\t\t|| (code >= 48 && code <= 57)) { // 0-9\n\t\t\t\t\t\t\t\tflags += this.char;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet value;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tvalue = new RegExp(pattern, flags);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\t\tthis.throwError(e.message);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tenv.node = {\n\t\t\t\t\t\t\ttype: jsep.LITERAL,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\traw: this.expr.slice(patternIndex - 1, this.index),\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// allow . [] and () after regex: /regex/.test(a)\n\t\t\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.code === jsep.OBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = true;\n\t\t\t\t\t}\n\t\t\t\t\telse if (inCharSet && this.code === jsep.CBRACK_CODE) {\n\t\t\t\t\t\tinCharSet = false;\n\t\t\t\t\t}\n\t\t\t\t\tthis.index += this.code === BSLASH_CODE ? 2 : 1;\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed Regex');\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const CONDITIONAL_EXP = 'ConditionalExpression';\n\nvar index = {\n\tname: 'ternary',\n\n\tinit(jsep) {\n\t\t// Ternary expression: test ? consequent : alternate\n\t\tjsep.hooks.add('after-expression', function gobbleTernary(env) {\n\t\t\tif (env.node && this.code === jsep.QUMARK_CODE) {\n\t\t\t\tthis.index++;\n\t\t\t\tconst test = env.node;\n\t\t\t\tconst consequent = this.gobbleExpression();\n\n\t\t\t\tif (!consequent) {\n\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t}\n\n\t\t\t\tthis.gobbleSpaces();\n\n\t\t\t\tif (this.code === jsep.COLON_CODE) {\n\t\t\t\t\tthis.index++;\n\t\t\t\t\tconst alternate = this.gobbleExpression();\n\n\t\t\t\t\tif (!alternate) {\n\t\t\t\t\t\tthis.throwError('Expected expression');\n\t\t\t\t\t}\n\t\t\t\t\tenv.node = {\n\t\t\t\t\t\ttype: CONDITIONAL_EXP,\n\t\t\t\t\t\ttest,\n\t\t\t\t\t\tconsequent,\n\t\t\t\t\t\talternate,\n\t\t\t\t\t};\n\n\t\t\t\t\t// check for operators of higher priority than ternary (i.e. assignment)\n\t\t\t\t\t// jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n\t\t\t\t\tif (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n\t\t\t\t\t\tlet newTest = test;\n\t\t\t\t\t\twhile (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n\t\t\t\t\t\t\tnewTest = newTest.right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tenv.node.test = newTest.right;\n\t\t\t\t\t\tnewTest.right = env.node;\n\t\t\t\t\t\tenv.node = test;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.throwError('Expected :');\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport { index as default };\n","const BTICK_CODE = 96; // `\nconst CCURLY_CODE = 125; // }\nconst TAGGED_TEMPLATE_EXPRESSION = 'TaggedTemplateExpression';\nconst TEMPLATE_LITERAL = 'TemplateLiteral';\nconst TEMPLATE_ELEMENT = 'TemplateElement';\n\nvar index = {\n\tname: 'jsepTemplateLiteral',\n\n\tinit(jsep) {\n\t\tfunction gobbleTemplateLiteral(env, gobbleMember = true) {\n\t\t\tif (this.code === BTICK_CODE) {\n\t\t\t\tconst node = {\n\t\t\t\t\ttype: TEMPLATE_LITERAL,\n\t\t\t\t\tquasis: [],\n\t\t\t\t\texpressions: [],\n\t\t\t\t};\n\t\t\t\tlet cooked = '';\n\t\t\t\tlet raw = '';\n\t\t\t\tlet closed = false;\n\t\t\t\tconst length = this.expr.length;\n\t\t\t\tconst pushQuasi = () => node.quasis.push({\n\t\t\t\t\ttype: TEMPLATE_ELEMENT,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\traw,\n\t\t\t\t\t\tcooked,\n\t\t\t\t\t},\n\t\t\t\t\ttail: closed,\n\t\t\t\t});\n\n\t\t\t\twhile (this.index < length) {\n\t\t\t\t\tlet ch = this.expr.charAt(++this.index);\n\n\t\t\t\t\tif (ch === '`') {\n\t\t\t\t\t\tthis.index += 1;\n\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\tpushQuasi();\n\n\t\t\t\t\t\tenv.node = node;\n\n\t\t\t\t\t\tif (gobbleMember) {\n\t\t\t\t\t\t // allow . [] and () after template: `foo`.length\n\t\t\t\t\t\t env.node = this.gobbleTokenProperty(env.node);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn env.node;\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '$' && this.expr.charAt(this.index + 1) === '{') {\n\t\t\t\t\t\tthis.index += 2;\n\t\t\t\t\t\tpushQuasi();\n\t\t\t\t\t\traw = '';\n\t\t\t\t\t\tcooked = '';\n\t\t\t\t\t\tnode.expressions.push(...this.gobbleExpressions(CCURLY_CODE));\n\t\t\t\t\t\tif (this.code !== CCURLY_CODE) {\n\t\t\t\t\t\t\tthis.throwError('unclosed ${');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (ch === '\\\\') {\n\t\t\t\t\t\t// Check for all of the common escape codes\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t\tch = this.expr.charAt(++this.index);\n\t\t\t\t\t\traw += ch;\n\n\t\t\t\t\t\tswitch (ch) {\n\t\t\t\t\t\t\tcase 'n': cooked += '\\n'; break;\n\t\t\t\t\t\t\tcase 'r': cooked += '\\r'; break;\n\t\t\t\t\t\t\tcase 't': cooked += '\\t'; break;\n\t\t\t\t\t\t\tcase 'b': cooked += '\\b'; break;\n\t\t\t\t\t\t\tcase 'f': cooked += '\\f'; break;\n\t\t\t\t\t\t\tcase 'v': cooked += '\\x0B'; break;\n\t\t\t\t\t\t\tdefault : cooked += ch;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcooked += ch;\n\t\t\t\t\t\traw += ch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.throwError('Unclosed `');\n\t\t\t}\n\t\t}\n\n\t\tjsep.hooks.add('gobble-token', gobbleTemplateLiteral);\n\n\t\tjsep.hooks.add('after-token', function gobbleTaggedTemplateIdentifier(env) {\n\t\t\tif ((env.node.type === jsep.IDENTIFIER || env.node.type === jsep.MEMBER_EXP) && this.code === BTICK_CODE) {\n\t\t\t\tenv.node = {\n\t\t\t\t\ttype: TAGGED_TEMPLATE_EXPRESSION,\n\t\t\t\t\ttag: env.node,\n\t\t\t\t\tquasi: gobbleTemplateLiteral.bind(this)(env, false),\n\t\t\t\t};\n\n\t\t\t\t// allow . [] and () after tagged template: bar`foo`.length\n\t\t\t\tenv.node = this.gobbleTokenProperty(env.node);\n\n\t\t\t\treturn env.node;\n\t\t\t}\n\t\t});\n\t}\n};\n\nexport { index as default };\n","/** @category Utility */\nimport jsep from 'jsep';\nimport jsepArrow, { type ArrowExpression } from '@jsep-plugin/arrow';\nimport jsepNew, { type NewExpression } from '@jsep-plugin/new';\nimport jsepNumbers from '@jsep-plugin/numbers';\nimport jsepRegex from '@jsep-plugin/regex';\nimport jsepTernary from '@jsep-plugin/ternary';\nimport jsepTemplate, { type TemplateElement, type TemplateLiteral } from '@jsep-plugin/template';\n\njsep.plugins.register(jsepArrow);\njsep.plugins.register(jsepNew);\njsep.plugins.register(jsepNumbers);\njsep.plugins.register(jsepRegex);\njsep.plugins.register(jsepTernary);\njsep.plugins.register(jsepTemplate);\n// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence\n// for the order defined here\n// 7 is jsep's internal for \"relational operators\"\njsep.addBinaryOp('in', 7);\njsep.addBinaryOp('??', 1);\n\n/** An object containing the variable to use when evaluating this expression */\nexport type VariablesMap = {\n [key: string]: string | number | boolean | Function | RegExp | object | null | VariablesMap | Array<VariablesMap>;\n};\n\n/** The valid return types for `evaluate()` and `evaluateAsync()` */\nexport type DefaultEvaluateReturnType = string | number | boolean | Date | null | undefined;\n\n/**\n * `evaluate()` implements a relatively safe version of `eval()` that is limited to evaluating synchronous\n * Javascript expressions. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = evaluate('!isEmpty(array)', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluate('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('isEmpty(array)');\n *\n * // then we use it like\n * evaluate(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluate(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluate(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsync()` implements a relatively safe version of `eval()` that can evaluate Javascript expressions\n * that use Promises. This allows us to safely add features that depend on user-supplied code without\n * polluting the global namespace or needing to support `eval()` and the like.\n *\n * By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined.\n * Other values will result in an error.\n *\n * @example\n * ```ts\n * // shouldDisplayOptionalData will be false\n * const shouldDisplayOptionalData = await evaluateAsync('Promise.resolve(!isEmpty(array))', {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * })\n * ```\n *\n * Since this only implements the expression lanaguage part of Javascript, there is no support for assigning\n * values, creating functions, or creating objects, so the following will throw an error:\n *\n * @example\n * ```ts\n * evaluateAsync('var a = 1; a');\n * ```\n *\n * In addition to string expressions, `evaluate()` can use an existing `jsep.Expression`, such as that returned\n * from the `compile()` function. The goal here is to support cases where the same expression will be evaluated\n * multiple times, possibly with different variables, e.g.,\n *\n * @example\n * ```ts\n * const expr = compile('Promise.resolve(isEmpty(array))');\n *\n * // then we use it like\n * evaluateAsync(expr, {\n * array: [],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n *\n * evaluateAsync(expr, {\n * array: ['value'],\n * isEmpty(arr: unknown) {\n * return Array.isArray(arr) && arr.length === 0;\n * }\n * ));\n * ```\n *\n * This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.\n *\n * The `variables` parameter should be used to supply any variables or functions that should be in-scope for\n * the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but\n * any non-global values will need to be passed as a variable. Note that expressions do not have any access to\n * the variables in the scope in which they were defined unless they are supplied here.\n *\n * **Note:** `evaluateAsync()` currently only supports Promise-based asynchronous flows and does not support\n * the `await` keyword.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, defaultTypePredicate);\n}\n\n/**\n * `evaluateAsBoolean()` is a variant of {@link evaluate()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBoolean(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsBooleanAsync()` is a variant of {@link evaluateAsync()} which only supports boolean results. Useful\n * if valid expression must return boolean values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsBooleanAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsTypeAsync(expression, variables, booleanTypePredicate);\n}\n\n/**\n * `evaluateAsNumber()` is a variant of {@link evaluate()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumber(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsNumberAsync()` is a variant of {@link evaluateAsync()} which only supports number results. Useful\n * if valid expression must return numeric values.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsNumberAsync(expression: string | jsep.Expression, variables: VariablesMap = {}) {\n return evaluateAsType(expression, variables, numberTypePredicate);\n}\n\n/**\n * `evaluateAsType()` is a type-safe version of {@link evaluate()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport function evaluateAsType<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): T {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n throw `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`;\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createSynchronousContext(variables);\n const result = visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context);\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n}\n\n/**\n * `evaluateAsTypeAsync()` is a type-safe version of {@link evaluateAsync()} which returns a result if the result\n * passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on\n * context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard\n * to ensure that only number or boolean results are returned.\n *\n * @param expression The expression to evaluate, either as a string or pre-parsed expression\n * @param variables Optional object which contains any variables, functions, etc. that will be available to\n * the expression.\n * @param typePredicate A [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)\n * which asserts that the result value matches one of the expected results.\n * @returns The result of evaluating the expression\n */\nexport async function evaluateAsTypeAsync<T>(\n expression: string | jsep.Expression,\n variables: VariablesMap = {},\n typePredicate: (result: unknown) => result is T,\n): Promise<T> {\n if (typeof expression !== 'string' && (typeof expression !== 'object' || !expression || !('type' in expression))) {\n return Promise.reject(\n `Unknown expression type ${expression}. Expressions must either be a string or pre-compiled string.`,\n );\n }\n\n if (typeof variables === 'undefined' || variables === null) {\n variables = {};\n }\n\n const context = createAsynchronousContext(variables);\n return Promise.resolve(visitExpression(typeof expression === 'string' ? jsep(expression) : expression, context)).then(\n (result) => {\n if (typePredicate(result)) {\n return result;\n } else {\n throw {\n type: 'Invalid result',\n message:\n typeof expression === 'string'\n ? `The expression ${expression} did not produce a valid result`\n : 'The expression did not produce a valid result',\n };\n }\n },\n );\n}\n\n/**\n * `compile()` is a companion function for use with {@link evaluate()} and the various `evaluateAs*()` functions.\n * It processes an expression string into the resulting AST that is executed by those functions. This is useful if\n * you have an expression that will need to be evaluated mulitple times, potentially with different values, as the\n * lexing and parsing steps can be skipped by using the AST object returned from this.\n *\n * The returned AST is intended to be opaque to client applications, but, of course, it is possible to manipulate\n * the AST before passing it back to {@link evaluate()}, if desired. This might be useful if, for example, certain\n * values are known to be constant.\n *\n * @param expression The expression to be parsed\n * @returns An executable AST representation of the expression\n */\nexport function compile(expression: string): jsep.Expression {\n return jsep(expression);\n}\n\n// Pre-defined type guards\nfunction defaultTypePredicate(result: unknown): result is DefaultEvaluateReturnType {\n return (\n typeof result === 'string' ||\n typeof result === 'number' ||\n typeof result === 'boolean' ||\n typeof result === 'undefined' ||\n result === null ||\n result instanceof Date\n );\n}\n\nfunction booleanTypePredicate(result: unknown): result is Boolean {\n return typeof result === 'boolean';\n}\n\nfunction numberTypePredicate(result: unknown): result is number {\n return typeof result === 'number';\n}\n\n// Implementation\n\n// This is the core of the implementation; it takes an expression, the variables and the current object\n// each expression is dispatched to an appropriate handler.\nfunction visitExpression(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'UnaryExpression':\n return visitUnaryExpression(expression as jsep.UnaryExpression, context);\n case 'BinaryExpression':\n return visitBinaryExpression(expression as jsep.BinaryExpression, context);\n case 'ConditionalExpression':\n return visitConditionalExpression(expression as jsep.ConditionalExpression, context);\n case 'CallExpression':\n return visitCallExpression(expression as jsep.CallExpression, context);\n case 'ArrowFunctionExpression':\n return visitArrowFunctionExpression(expression as ArrowExpression, context);\n case 'MemberExpression':\n return visitMemberExpression(expression as jsep.MemberExpression, context);\n case 'ArrayExpression':\n return visitArrayExpression(expression as jsep.ArrayExpression, context);\n case 'SequenceExpression':\n return visitSequenceExpression(expression as jsep.SequenceExpression, context);\n case 'NewExpression':\n return visitNewExpression(expression as NewExpression, context);\n case 'Literal':\n return visitLiteral(expression as jsep.Literal, context);\n case 'Identifier':\n return visitIdentifier(expression as jsep.Identifier, context);\n case 'TemplateLiteral':\n return visitTemplateLiteral(expression as TemplateLiteral, context);\n case 'TemplateElement':\n return visitTemplateElement(expression as TemplateElement, context);\n default:\n throw `Expression evaluator does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitExpressionName(expression: jsep.Expression, context: EvaluationContext) {\n switch (expression.type) {\n case 'Literal':\n return (expression as jsep.Literal).value as string;\n case 'Identifier':\n return (expression as jsep.Identifier).name;\n case 'MemberExpression':\n return visitExpressionName((expression as jsep.MemberExpression).property, context);\n default:\n throw `VisitExpressionName does not support expression of type '${expression.type}'`;\n }\n}\n\nfunction visitUnaryExpression(expression: jsep.UnaryExpression, context: EvaluationContext) {\n const value = visitExpression(expression.argument, context);\n\n switch (expression.operator) {\n case '+':\n return +value;\n case '-':\n return -value;\n case '~':\n return ~value;\n case '!':\n return !value;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}''`;\n }\n}\n\nfunction visitBinaryExpression(expression: jsep.BinaryExpression, context: EvaluationContext) {\n let left = visitExpression(expression.left, context);\n let right = visitExpression(expression.right, context);\n\n switch (expression.operator) {\n case '+':\n return left + right;\n case '-':\n return left - right;\n case '*':\n return left * right;\n case '/':\n return left / right;\n case '%':\n return left % right;\n case '**':\n return left ** right;\n case '==':\n return left == right;\n case '===':\n return left === right;\n case '!=':\n return left != right;\n case '!==':\n return left !== right;\n case '>':\n return left > right;\n case '>=':\n return left >= right;\n case '<':\n return left < right;\n case '<=':\n return left <= right;\n case 'in':\n return left in right;\n case '&&':\n return left && right;\n case '||':\n return left || right;\n case '??':\n return left ?? right;\n default:\n throw `Expression evaluator does not support operator '${expression.operator}' operator`;\n }\n}\n\nfunction visitConditionalExpression(expression: jsep.ConditionalExpression, context: EvaluationContext) {\n const test = visitExpression(expression.test, context);\n return test ? visitExpression(expression.consequent, context) : visitExpression(expression.alternate, context);\n}\n\nfunction visitCallExpression(expression: jsep.CallExpression, context: EvaluationContext) {\n let args = expression.arguments?.map(handleNullableExpression(context));\n let callee = visitExpression(expression.callee, context);\n\n if (!callee) {\n throw `No function named ${expression.callee} is defined in this context`;\n } else if (!(callee instanceof Function)) {\n throw `${expression.callee} is not a function`;\n }\n\n return callee(...args);\n}\n\nfunction visitArrowFunctionExpression(expression: ArrowExpression, context: EvaluationContext) {\n const params =\n expression.params?.map((p) => {\n switch (p.type) {\n case 'Identifier':\n return (p as jsep.Identifier).name;\n default:\n throw `Cannot handle parameter of type ${p.type}`;\n }\n }) ?? [];\n\n return function (...rest: unknown[]) {\n if (rest.length < params.length) {\n throw `Required argument(s) ${params.slice(rest.length, -1).join(', ')} were not provided`;\n }\n\n const vars = Object.fromEntries(\n params.reduce((acc: Array<[string, VariablesMap['a']]>, p, idx) => {\n const val = rest[idx];\n if (isValidVariableType(val)) {\n acc.push([p, val]);\n }\n return acc;\n }, []),\n );\n\n return visitExpression(expression.body, context.addVariables(vars));\n }.bind(context.thisObj ?? null);\n}\n\nfunction visitMemberExpression(expression: jsep.MemberExpression, context: EvaluationContext) {\n let obj = visitExpression(expression.object, context);\n\n if (obj === undefined) {\n switch (expression.object.type) {\n case 'Identifier': {\n let objectName = visitExpressionName(expression.object, context);\n throw ReferenceError(`ReferenceError: ${objectName} is not defined`);\n }\n case 'MemberExpression': {\n let propertyName = visitExpressionName(expression.property, context);\n throw TypeError(`TypeError: cannot read properties of undefined (reading '${propertyName}')`);\n }\n default:\n throw `VisitMemberExpression does not support operator '${expression.object.type}' type`;\n }\n }\n\n let newObj = obj;\n if (typeof obj === 'string') {\n newObj = String.prototype;\n } else if (typeof obj === 'number') {\n newObj = Number.prototype;\n } else if (typeof obj === 'function') {\n // no-op\n } else if (typeof obj !== 'object') {\n throw `VisitMemberExpression does not support member access on type ${typeof obj}`;\n }\n\n context.thisObj = newObj;\n\n let result: unknown;\n switch (expression.property.type) {\n case 'Identifier':\n case 'MemberExpression':\n result = visitExpression(expression.property, context);\n break;\n default: {\n const property = visitExpression(expression.property, context);\n if (typeof property === 'undefined') {\n throw { type: 'Illegal property access', message: 'No property was supplied to the property access' };\n }\n validatePropertyName(property);\n result = obj[property];\n }\n }\n\n if (typeof result === 'function') {\n return result.bind(obj);\n }\n\n return result;\n}\n\nfunction visitArrayExpression(expression: jsep.ArrayExpression, context: EvaluationContext) {\n return expression.elements?.map(handleNullableExpression(context));\n}\n\nfunction visitSequenceExpression(expression: jsep.SequenceExpression, context: EvaluationContext) {\n const result = expression.expressions.map(handleNullableExpression(context));\n return result[result.length - 1];\n}\n\nfunction visitNewExpression(expression: NewExpression, context: EvaluationContext) {\n if (expression.callee && expression.callee.type === 'Identifier') {\n let args = expression.arguments?.map(handleNullableExpression(context)) as Array<any>;\n switch (expression.callee.name) {\n case 'Date': {\n /** @ts-ignore because we can use the spread operator here */\n return new Date(...args);\n }\n case 'RegExp':\n /** @ts-ignore because we can use the spread operator here */\n return new RegExp(...args);\n default:\n throw `Cannot instantiate object of type ${expression.callee.name}`;\n }\n } else {\n if (!expression.callee) {\n throw `Could not handle \"new\" without a specified class`;\n } else {\n throw 'new must be called with either Date or RegExp';\n }\n }\n}\n\nfunction visitTemplateLiteral(expression: TemplateLiteral, context: EvaluationContext) {\n const expressions: Array<unknown> = expression.expressions?.map(handleNullableExpression(context)) ?? [];\n const quasis: Array<{ tail: boolean; value: unknown }> =\n expression.quasis?.map(handleNullableExpression(context)) ?? [];\n return (\n quasis\n .filter((q) => !q.tail)\n .map((q) => q.value)\n .join('') +\n expressions.join('') +\n quasis\n .filter((q) => q.tail)\n .map((q) => q.value)\n .join('')\n );\n}\n\nfunction visitTemplateElement(expression: TemplateElement, context: EvaluationContext) {\n return { value: expression.cooked, tail: expression.tail };\n}\n\nfunction visitIdentifier(expression: jsep.Identifier, context: EvaluationContext) {\n validatePropertyName(expression.name);\n\n // we support both `object` and `function` in the same way as technically property access on functions\n // is possible; the use-case here is to support JS's \"static\" functions like `Number.isInteger()`, which\n // is technically reading a property on a function\n const thisObj = context.thisObj;\n if (thisObj && (typeof thisObj === 'object' || typeof thisObj === 'function') && expression.name in thisObj) {\n const result = thisObj[expression.name];\n validatePropertyName(result);\n return result;\n } else if (context.variables && expression.name in context.variables) {\n const result = context.variables[expression.name];\n validatePropertyName(result);\n return result;\n } else if (expression.name in context.globals) {\n return context.globals[expression.name];\n } else {\n return undefined;\n }\n}\n\nfunction visitLiteral(expression: jsep.Literal, context: EvaluationContext) {\n validatePropertyName(expression.value);\n return expression.value;\n}\n\n// Internal helpers and utilities\n\ninterface EvaluationContext {\n thisObj: object | undefined;\n variables: VariablesMap;\n globals: typeof globals | typeof globalsAsync;\n addVariables(vars: VariablesMap): EvaluationContext;\n}\n\nfunction createSynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globals);\n}\n\nfunction createAsynchronousContext(variables: VariablesMap): EvaluationContext {\n return createContextInternal(variables, globalsAsync);\n}\n\nfunction createContextInternal(variables: VariablesMap, globals_: typeof globals | typeof globalsAsync) {\n const context = {\n thisObj: undefined,\n variables: { ...variables },\n globals: { ...globals_ },\n addVariables(vars: VariablesMap) {\n this.variables = { ...this.variables, ...vars };\n return this;\n },\n };\n\n context.addVariables.bind(context);\n\n return context;\n}\n\n// helper useful for handling arrays of expressions, since `null` expressions should not be\n// dispatched to `visitExpression()`\nfunction handleNullableExpression(context: EvaluationContext) {\n return function handleNullableExpressionInner(expression: jsep.Expression | null) {\n if (expression === null) {\n return null;\n }\n\n return visitExpression(expression, context);\n };\n}\n\nfunction validatePropertyName(name: unknown) {\n if (name === '__proto__' || name === 'prototype' || name === 'constructor') {\n throw { type: 'Illegal property access', message: `Cannot access the ${name} property of objects` };\n }\n}\n\nfunction isValidVariableType(val: unknown): val is VariablesMap['a'] {\n if (\n typeof val === 'string' ||\n typeof val === 'number' ||\n typeof val === 'boolean' ||\n typeof val === 'function' ||\n val === null ||\n val instanceof RegExp\n ) {\n return true;\n }\n\n if (typeof val === 'object') {\n for (const key of Object.keys(val)) {\n if (!isValidVariableType(val[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n if (Array.isArray(val)) {\n for (const item of val) {\n if (!isValidVariableType(item)) {\n return false;\n }\n }\n }\n\n return false;\n}\n\nconst globals = {\n Array,\n Boolean,\n Symbol,\n Infinity,\n NaN,\n Math,\n Number,\n BigInt,\n String,\n RegExp,\n JSON,\n isFinite,\n isNaN,\n parseFloat,\n parseInt,\n decodeURI,\n encodeURI,\n encodeURIComponent,\n Object: {\n __proto__: undefined,\n assign: Object.assign.bind(null),\n fromEntries: Object.fromEntries.bind(null),\n hasOwn: Object.hasOwn.bind(null),\n keys: Object.keys.bind(null),\n is: Object.is.bind(null),\n values: Object.values.bind(null),\n },\n};\n\nconst globalsAsync = {\n ...globals,\n Promise,\n};\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Jsep","version","static","op_name","max_unop_len","Math","max","length","unary_ops","precedence","isRightAssociative","max_binop_len","binary_ops","right_associative","add","delete","char","additional_identifier_chars","literal_name","literal_value","literals","getMaxKeyLen","this","expr","charAt","index","code","charCodeAt","constructor","parse","keys","map","k","ch","op_val","String","fromCharCode","has","isIdentifierStart","isDecimalDigit","throwError","message","error","Error","description","runHook","name","node","hooks","env","context","run","searchHook","find","callback","gobbleSpaces","SPACE_CODE","TAB_CODE","LF_CODE","CR_CODE","nodes","gobbleExpressions","type","COMPOUND","body","untilICode","ch_i","SEMCOL_CODE","COMMA_CODE","gobbleExpression","push","gobbleBinaryExpression","gobbleBinaryOp","to_check","substr","tc_len","isIdentifierPart","biop","prec","stack","biop_info","left","right","i","cur_biop","gobbleToken","binaryPrecedence","right_a","comparePrev","prev","pop","BINARY_EXP","operator","PERIOD_CODE","gobbleNumericLiteral","SQUOTE_CODE","DQUOTE_CODE","gobbleStringLiteral","OBRACK_CODE","gobbleArray","argument","UNARY_EXP","prefix","gobbleIdentifier","LITERAL","raw","this_str","THIS_EXP","OPAREN_CODE","gobbleGroup","gobbleTokenProperty","QUMARK_CODE","optional","MEMBER_EXP","computed","object","property","CBRACK_CODE","CALL_EXP","gobbleArguments","CPAREN_CODE","callee","chCode","number","parseFloat","str","startIndex","quote","closed","substring","start","IDENTIFIER","slice","termination","args","separator_count","arg","SEQUENCE_EXP","expressions","ARRAY_EXP","elements","first","arguments","Array","isArray","forEach","assign","plugins","jsep","registered","register","plugin","init","COLON_CODE","Set","stdClassProps","getOwnPropertyNames","filter","includes","undefined","m","ternary","test","consequent","alternate","newTest","ARROW_EXP","updateBinariesToArrows","values","val","params","addBinaryOp","backupIndex","addUnaryOp","callNode","getNumberCodeRanges","numType","getNumberBase","isUnderscoreOrWithinRange","ranges","some","min","gobbleBase10","gobbleDigits","JSON","stringify","parseInt","patternIndex","inCharSet","pattern","flags","RegExp","e","gobbleTemplateLiteral","gobbleMember","quasis","cooked","pushQuasi","tail","tag","quasi","bind","evaluate","expression","evaluateAsType","variables","defaultTypePredicate","evaluateAsync","evaluateAsTypeAsync","evaluateAsBoolean","booleanTypePredicate","evaluateAsBooleanAsync","evaluateAsNumber","numberTypePredicate","evaluateAsNumberAsync","typePredicate","createContextInternal","globals","createSynchronousContext","result","visitExpression","globalsAsync","createAsynchronousContext","Promise","resolve","then","reject","compile","Date","visitUnaryExpression","visitBinaryExpression","visitConditionalExpression","handleNullableExpression","Function","visitCallExpression","p","rest","join","vars","fromEntries","reduce","acc","idx","isValidVariableType","addVariables","thisObj","visitArrowFunctionExpression","objectName","visitExpressionName","ReferenceError","propertyName","TypeError","newObj","Number","validatePropertyName","visitMemberExpression","visitArrayExpression","visitSequenceExpression","visitNewExpression","visitLiteral","visitIdentifier","q","visitTemplateLiteral","visitTemplateElement","globals_","jsepArrow","jsepNew","jsepNumbers","jsepRegex","jsepTernary","jsepTemplate","Boolean","Infinity","NaN","BigInt","isFinite","isNaN","decodeURI","encodeURI","encodeURIComponent","__proto__","hasOwn","is"],"sourceRoot":""}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openmrs/esm-expression-evaluator",
|
|
3
|
+
"version": "5.8.1-pre.2234",
|
|
4
|
+
"license": "MPL-2.0",
|
|
5
|
+
"description": "Utilities for evaluating user-defined expressions",
|
|
6
|
+
"browser": "dist/openmrs-esm-expression-evaluator.js",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"source": true,
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "cross-env TZ=UTC jest --config jest.config.js --verbose false --passWithNoTests --color",
|
|
12
|
+
"test:watch": "cross-env TZ=UTC jest --watch --config jest.config.js --color",
|
|
13
|
+
"build": "webpack --mode=production",
|
|
14
|
+
"build:development": "webpack --mode development",
|
|
15
|
+
"analyze": "webpack --mode=production --env analyze=true",
|
|
16
|
+
"typescript": "tsc",
|
|
17
|
+
"lint": "eslint src --ext ts,tsx"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"openmrs",
|
|
21
|
+
"microfrontends"
|
|
22
|
+
],
|
|
23
|
+
"directories": {
|
|
24
|
+
"lib": "dist",
|
|
25
|
+
"src": "src"
|
|
26
|
+
},
|
|
27
|
+
"browserslist": [
|
|
28
|
+
"extends browserslist-config-openmrs"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/openmrs/openmrs-esm-core.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/openmrs/openmrs-esm-core/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/openmrs/openmrs-esm-core#readme",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@jsep-plugin/arrow": "^1.0.5",
|
|
43
|
+
"@jsep-plugin/new": "^1.0.3",
|
|
44
|
+
"@jsep-plugin/numbers": "^1.0.1",
|
|
45
|
+
"@jsep-plugin/regex": "^1.0.3",
|
|
46
|
+
"@jsep-plugin/template": "^1.0.4",
|
|
47
|
+
"@jsep-plugin/ternary": "^1.1.3",
|
|
48
|
+
"jsep": "^1.3.9"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"cross-env": "^7.0.3",
|
|
52
|
+
"jest": "^29.7.0",
|
|
53
|
+
"jest-cli": "^29.7.0"
|
|
54
|
+
},
|
|
55
|
+
"stableVersion": "5.7.2"
|
|
56
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { compile, evaluate, evaluateAsBoolean, evaluateAsNumber, evaluateAsType, evaluateAsync } from './evaluator';
|
|
2
|
+
|
|
3
|
+
describe('OpenMRS Expression Evaluator', () => {
|
|
4
|
+
it('Should evaluate a simple expression', () => {
|
|
5
|
+
expect(evaluate('1 + 1')).toBe(2);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('Should support mulitplication', () => {
|
|
9
|
+
expect(evaluate('1 * 2')).toBe(2);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('Should support the not operator', () => {
|
|
13
|
+
expect(evaluate('!1')).toBe(false);
|
|
14
|
+
expect(evaluate('!0')).toBe(true);
|
|
15
|
+
expect(evaluate('!true')).toBe(false);
|
|
16
|
+
expect(evaluate('!false')).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('Should support expressions in parentheses', () => {
|
|
20
|
+
expect(evaluate('(1, 2, 3)')).toBe(3);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('Should support order of operations', () => {
|
|
24
|
+
expect(evaluate('(1 + 2) * 3')).toBe(9);
|
|
25
|
+
expect(evaluate('1 + 2 * 3')).toBe(7);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("Should support javascript's type promotion", () => {
|
|
29
|
+
expect(evaluate("1 + 'string'")).toBe('1string');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("Should support 'in'", () => {
|
|
33
|
+
expect(evaluate('1 in [1, 2, 3]')).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('Should support basic variables', () => {
|
|
37
|
+
expect(evaluate('1 + a', { a: 3 })).toBe(4);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('Should support nullish coalescing', () => {
|
|
41
|
+
expect(evaluate('a ?? b', { a: null, b: 3 })).toBe(3);
|
|
42
|
+
expect(evaluate('a ?? b', { a: 3, b: null })).toBe(3);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('Should support functions', () => {
|
|
46
|
+
expect(evaluate('a(1)', { a: (i: number) => i + 1 })).toBe(2);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('Should support built-in functions', () => {
|
|
50
|
+
expect(evaluate('a.includes("v")', { a: 'value' })).toBe(true);
|
|
51
|
+
expect(evaluate('"value".includes("v")')).toBe(true);
|
|
52
|
+
expect(evaluate('(3.14159).toPrecision(3)')).toBe('3.14');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('Should give a useful error message for properties on missing objects', () => {
|
|
56
|
+
expect(() => evaluate('a.b')).toThrow('ReferenceError: a is not defined');
|
|
57
|
+
expect(() => evaluate('a["b"]')).toThrow('ReferenceError: a is not defined');
|
|
58
|
+
expect(() => evaluate('a.b.c', { a: {} })).toThrow("TypeError: cannot read properties of undefined (reading 'c')");
|
|
59
|
+
expect(() => evaluate('a.b["c"]', { a: {} })).toThrow(
|
|
60
|
+
"TypeError: cannot read properties of undefined (reading 'c')",
|
|
61
|
+
);
|
|
62
|
+
expect(() => evaluate('a["b"]["c"]', { a: {} })).toThrow(
|
|
63
|
+
"TypeError: cannot read properties of undefined (reading 'c')",
|
|
64
|
+
);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('Should not support this', () => {
|
|
68
|
+
expect(() => evaluate('this')).toThrow(
|
|
69
|
+
/Expression evaluator does not support expression of type 'ThisExpression'.*/i,
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('Should support property references', () => {
|
|
74
|
+
expect(evaluate('a.b.c', { a: { b: { c: 3 } } })).toBe(3);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('Should not support prototype references', () => {
|
|
78
|
+
expect(() => evaluate('a.__proto__', { a: {} })).toThrow(/Cannot access the __proto__ property .*/i);
|
|
79
|
+
expect(() => evaluate('a["__proto__"]', { a: {} })).toThrow(/Cannot access the __proto__ property .*/i);
|
|
80
|
+
expect(() => evaluate('a[b]', { a: {}, b: '__proto__' })).toThrow(/Cannot access the __proto__ property .*/i);
|
|
81
|
+
expect(() => evaluate('a[b()]', { a: {}, b: () => '__proto__' })).toThrow(
|
|
82
|
+
/Cannot access the __proto__ property .*/i,
|
|
83
|
+
);
|
|
84
|
+
expect(() => evaluate('__proto__')).toThrow(/Cannot access the __proto__ property .*/i);
|
|
85
|
+
expect(() => evaluate('a.prototype', { a: {} })).toThrow(/Cannot access the prototype property .*/i);
|
|
86
|
+
expect(() => evaluate('a["prototype"]', { a: {} })).toThrow(/Cannot access the prototype property .*/i);
|
|
87
|
+
expect(() => evaluate('a[b]', { a: {}, b: 'prototype' })).toThrow(/Cannot access the prototype property .*/i);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('Should support ternaries', () => {
|
|
91
|
+
expect(evaluate('a ? 1 : 2', { a: true })).toBe(1);
|
|
92
|
+
expect(evaluate('a ? 1 : 2', { a: false })).toBe(2);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('Should support hexdecimal', () => {
|
|
96
|
+
expect(evaluate('0xff')).toBe(255);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('Should support string templates', () => {
|
|
100
|
+
expect(evaluate('`${a.b}`', { a: { b: 'string' } })).toBe('string');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('Should support new Date()', () => {
|
|
104
|
+
expect(evaluate('new Date().getTime()')).toBeLessThanOrEqual(new Date().getTime());
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('Should support RegExp', () => {
|
|
108
|
+
expect(evaluate('/.*/.test(a)', { a: 'a' })).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('Should support RegExp objects', () => {
|
|
112
|
+
expect(evaluate('new RegExp(".*").test(a)', { a: 'a' })).toBe(true);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('Should support arrow functions inside expressions', () => {
|
|
116
|
+
expect(evaluate('[1, 2, 3].find(v => v === 3)')).toBe(3);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('Should support globals', () => {
|
|
120
|
+
expect(evaluate('NaN')).toBeNaN();
|
|
121
|
+
expect(evaluate('Infinity')).toBe(Infinity);
|
|
122
|
+
expect(evaluate('Boolean(true)')).toBe(true);
|
|
123
|
+
expect(evaluate('Math.min(1, 2, 3)')).toBe(1);
|
|
124
|
+
expect(evaluate('undefined')).toBeUndefined();
|
|
125
|
+
expect(evaluate('isNaN(NaN)')).toBe(true);
|
|
126
|
+
expect(evaluate('Number.isInteger(42)')).toBe(true);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('Should not support creating arbitrary objects', () => {
|
|
130
|
+
expect(() => evaluate('new object()')).toThrow(/Cannot instantiate object .*/i);
|
|
131
|
+
class Fn {
|
|
132
|
+
constructor() {}
|
|
133
|
+
}
|
|
134
|
+
expect(() => evaluate('new Fn()', { Fn })).toThrow(/Cannot instantiate object .*/i);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('Should not support invalid property references on supported objects', () => {
|
|
138
|
+
expect(() => evaluate('new Date().__proto__')).toThrow(/Cannot access the __proto__ property .*/i);
|
|
139
|
+
expect(() => evaluate('new Date().prototype')).toThrow(/Cannot access the prototype property .*/i);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('Should not return invalid types', () => {
|
|
143
|
+
expect(() => evaluate('a', { a: {} })).toThrow(/.* did not produce a valid result/i);
|
|
144
|
+
expect(() => evaluateAsBoolean('a', { a: 'value' })).toThrow(/.* did not produce a valid result/i);
|
|
145
|
+
expect(() => evaluateAsNumber('a', { a: true })).toThrow(/.* did not produce a valid result/i);
|
|
146
|
+
expect(() => evaluateAsType('a', { a: false }, (val): val is 'value' => val === 'value')).toThrow(
|
|
147
|
+
/.* did not produce a valid result/i,
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('Should support a compilation phase', () => {
|
|
152
|
+
const exp = compile('1 + 1');
|
|
153
|
+
expect(evaluate(exp)).toBe(2);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('Should not support variable assignement', () => {
|
|
157
|
+
expect(() => evaluate('var a = 1; a')).toThrow();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('Should support asynchronous evaluation', async () => {
|
|
161
|
+
await expect(evaluateAsync('1 + 1')).resolves.toBe(2);
|
|
162
|
+
let a = new Promise((resolve) => {
|
|
163
|
+
setTimeout(() => resolve(1), 10);
|
|
164
|
+
});
|
|
165
|
+
await expect(evaluateAsync('Promise.resolve(a).then((a) => a + 1)', { a })).resolves.toBe(2);
|
|
166
|
+
a = new Promise((resolve) => {
|
|
167
|
+
setTimeout(() => resolve(1), 10);
|
|
168
|
+
});
|
|
169
|
+
await expect(
|
|
170
|
+
evaluateAsync('resolve(a).then((a) => a + 1)', { a, resolve: Promise.resolve.bind(Promise) }),
|
|
171
|
+
).resolves.toBe(2);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('Should support real-world use-cases', () => {
|
|
175
|
+
expect(
|
|
176
|
+
evaluate('!isEmpty(array)', {
|
|
177
|
+
array: [],
|
|
178
|
+
isEmpty(arr: unknown) {
|
|
179
|
+
return Array.isArray(arr) && arr.length === 0;
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
).toBe(false);
|
|
183
|
+
|
|
184
|
+
expect(
|
|
185
|
+
evaluate(
|
|
186
|
+
"includes(referredToPreventionServices, '88cdde2b-753b-48ac-a51a-ae5e1ab24846') && !includes(referredToPreventionServices, '1691AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')",
|
|
187
|
+
{
|
|
188
|
+
referredToPreventionServices: ['88cdde2b-753b-48ac-a51a-ae5e1ab24846'],
|
|
189
|
+
includes: <T>(collection: Array<T>, value: T) => Array.prototype.includes.call(collection, value),
|
|
190
|
+
},
|
|
191
|
+
),
|
|
192
|
+
).toBe(true);
|
|
193
|
+
});
|
|
194
|
+
});
|