Added 'if' function for math.js to use whenever eval-ing input

This commit is contained in:
Robert Perce
2016-05-03 14:44:40 -05:00
parent 684eca8603
commit 9b72e1aea2

View File

@@ -1,3 +1,12 @@
// if we want to add more functions, consider pulling out into its own file
(function() {
math.import({
"if": function(pred, a, b) {
return (!!(pred)) ? a : b;
}
});
})();
//evaluates a calculation string
evaluate = function(charId, string){
if (!string) return string;