Skip to content

Commit

Permalink
fix: avoid wrong cache
Browse files Browse the repository at this point in the history
  • Loading branch information
3cp committed Jul 9, 2021
1 parent 6a8d1de commit b388fe0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/value-evaluator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import _ from 'lodash';
import ScopedEval from 'scoped-eval';

const scopedEval = new ScopedEval();
const cache = Object.create(null);
const expCache = Object.create(null);
const interoperationCache = Object.create(null);

function build(expression, stringInterpolationMode = false) {
const cache = stringInterpolationMode ? interoperationCache : expCache;
if (!cache[expression]) {
try {
cache[expression] = scopedEval.build(expression, stringInterpolationMode);
Expand Down

0 comments on commit b388fe0

Please sign in to comment.