Skip to content

Commit

Permalink
remember order of operations in JS
Browse files Browse the repository at this point in the history
  • Loading branch information
yeedle committed Sep 29, 2020
1 parent 991f55c commit 1b92bda
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions inst/htmlwidgets/lib/georaster-for-leaflet/georasterUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,9 @@ function evalMath(a, values) {

const compiledExpressions = {}
function evalMath(rawExpression, values) {
console.log(`raw expression, ${JSON.stringify(rawExpression)}`)
console.log('raw expression is not in compiledexpressions', !rawExpression in compiledExpressions)
if (!rawExpression in compiledExpressions) {
console.log('storing raw expression in compiled')
if (!(rawExpression in compiledExpressions)) {
compiledExpressions[rawExpression] = safeCompile(rawExpression).evaluate;
}
console.log('cached expression', compiledExpressions[rawExpression])
return compiledExpressions[rawExpression]({values});
}

Expand Down

0 comments on commit 1b92bda

Please sign in to comment.