Skip to content

Commit

Permalink
merge second part of yeedle
Browse files Browse the repository at this point in the history
Merge branch 'master' of https://github.com/yeedle/leafem into yeedle-master

# Conflicts:
#	inst/htmlwidgets/lib/georaster-for-leaflet/georasterUtils.js
#	inst/htmlwidgets/lib/georaster-for-leaflet/mathjs.min.js
  • Loading branch information
tim-salabim committed Oct 9, 2020
2 parents 2ed08eb + 1b92bda commit 0bb9461
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion inst/htmlwidgets/lib/georaster-for-leaflet/georasterUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ function evalMath(a, values) {
return Function('values', 'with(Math) return ' + a)(values);
} */

const compiledExpressions = {}
function evalMath(rawExpression, values) {
return safeEval(rawExpression, {values});
if (!(rawExpression in compiledExpressions)) {
compiledExpressions[rawExpression] = safeCompile(rawExpression).evaluate;
}
return compiledExpressions[rawExpression]({values});
}

// helpers from https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
Expand Down
5 changes: 3 additions & 2 deletions inst/htmlwidgets/lib/georaster-for-leaflet/mathjs.min.js

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

0 comments on commit 0bb9461

Please sign in to comment.