(datum, ex)
| 6256 | } |
| 6257 | } |
| 6258 | runExpressionOnColumn(datum, ex) { |
| 6259 | const actualDataValue = datum[ex.name]; |
| 6260 | if (ex.operator === "isnullorEmpty") return isnullorEmpty(actualDataValue); |
| 6261 | else if (ex.operator === "!isnullorEmpty") return !isnullorEmpty(actualDataValue); |
| 6262 | let dataValue = actualDataValue; |
| 6263 | let expressionValue = ex.value; |
| 6264 | if (ex.column) { |
| 6265 | if (ex.column.type === "string" || ex.stringOperation) { |
| 6266 | dataValue = valueToString(actualDataValue).toLocaleLowerCase(); |
| 6267 | expressionValue = ex.valueLow; |
| 6268 | } else if (ex.column.type === "boolean") { |
| 6269 | dataValue = valueToBoolean(actualDataValue); |
| 6270 | expressionValue = ex.valueBool; |
| 6271 | } else if (ex.column.quantitative) { |
| 6272 | dataValue = +actualDataValue; |
| 6273 | expressionValue = +ex.value; |
| 6274 | } |
| 6275 | } |
| 6276 | switch(ex.operator){ |
| 6277 | case "!=": |
| 6278 | return dataValue != expressionValue; |
| 6279 | case "<": |
| 6280 | return dataValue < expressionValue; |
| 6281 | case "<=": |
| 6282 | return dataValue <= expressionValue; |
| 6283 | case "==": |
| 6284 | return dataValue == expressionValue; |
| 6285 | case ">": |
| 6286 | return dataValue > expressionValue; |
| 6287 | case ">=": |
| 6288 | return dataValue >= expressionValue; |
| 6289 | case "contains": |
| 6290 | return dataValue.indexOf(expressionValue) >= 0; |
| 6291 | case "!contains": |
| 6292 | return dataValue.indexOf(expressionValue) < 0; |
| 6293 | case "starts": |
| 6294 | return dataValue.indexOf(expressionValue) == 0; |
| 6295 | case "!starts": |
| 6296 | return dataValue.indexOf(expressionValue) !== 0; |
| 6297 | } |
| 6298 | } |
| 6299 | runExpression(datum, ex) { |
| 6300 | if (ex.name == null) { |
| 6301 | //run on all columns |
no test coverage detected