Skip to content

Commit

Permalink
fix: Not closing sub-evaluation when there is arg-evaluation as last one
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Sierociński committed Mar 21, 2020
1 parent f7226e6 commit f27016f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion dist/meval.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* meval v1.0.0 | Copyright 2020 (c) Marek Sierociński| https://github.com/marverix/meval/blob/master/LICENSE */
/* meval v1.0.1 | Copyright 2020 (c) Marek Sierociński| https://github.com/marverix/meval/blob/master/LICENSE */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
Expand Down Expand Up @@ -1828,6 +1828,7 @@
}, {
key: "execute",
value: function execute() {
this.idx--;
return new operators.FunctionCall(this.entities);
}
}]);
Expand Down
4 changes: 2 additions & 2 deletions dist/meval.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meval",
"version": "1.0.0",
"version": "1.0.1",
"description": "Mimic eval in given context",
"main": "dist/meval.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/Evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class ArgEvaluation extends SubEvaluation {
}

execute () {
this.idx--;
return new operators.FunctionCall(this.entities);
}

Expand Down
12 changes: 7 additions & 5 deletions test/debug.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const meval = require('../src');

console.log(
meval('x.toLowerCase()', {
x: 'Hello World'
})
);
var x = meval('(item.fromTime == null || item.fromTime <= Date.now()) && (item.toTime == null || item.toTime > Date.now())', {
item: {
fromTime: null,
toTime: 1584794436402
}
});
console.log(x);

0 comments on commit f27016f

Please sign in to comment.