Merge pull request #52 from ThaumRystra/user-story-127

Added 'if' function for math.js to use whenever eval-ing input, closes #32
This commit is contained in:
Stefan Zermatten
2016-05-04 07:43:21 +02:00

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;