Added if function
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import * as math from 'mathjs';
|
||||
import math from '/imports/math.js';
|
||||
import replaceBareSymbolsWithValueAccessor from '/imports/api/creature/computation/utility/replaceBareSymbolsWithValueAccessor.js';
|
||||
|
||||
export default function evaluateString(string, scope){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import replaceBareSymbolsWithValueAccessor from '/imports/api/creature/computation/utility/replaceBareSymbolsWithValueAccessor.js';
|
||||
import computeStat from '/imports/api/creature/computation/computeStat.js';
|
||||
import * as math from 'mathjs';
|
||||
import math from '/imports/math.js';
|
||||
|
||||
export default function evaluateCalculation(string, memo){
|
||||
if (!string) return string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as math from 'mathjs';
|
||||
import math from '/imports/math.js';
|
||||
|
||||
export default function replaceBareSymbolsWithValueAccessor(node, path) {
|
||||
if (node.isFunctionNode){
|
||||
|
||||
9
app/imports/math.js
Normal file
9
app/imports/math.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { create, all } from 'mathjs';
|
||||
const math = create(all);
|
||||
math.import({
|
||||
'if': function(pred, a, b) {
|
||||
return pred ? a : b;
|
||||
}
|
||||
});
|
||||
|
||||
export default math;
|
||||
Reference in New Issue
Block a user