@fw-components/formula-editor
Advanced tools
Comparing version
@@ -93,7 +93,7 @@ import Big from "big.js"; | ||
if (!(isNumber || isOperator || isBracket || isSpace)) { | ||
parseOutput.errorString = `${this.variableType} : '${token}' does not exist`; | ||
parseOutput.errorString = `${this.variableType} : '${token}' doesn't exist.`; | ||
expectation = Expectation.UNDEFINED; | ||
} | ||
else if (this.allowedOperators.has(previousToken) && isOperator) { | ||
parseOutput.errorString = `Please use ${this.variableType}${this.allowedNumbers ? " or numbers" : ""} after '${previousToken}'. Pls do not use consecutive two mathametical operators (+ - * / ^)`; | ||
parseOutput.errorString = `Please don't use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) consecutively.`; | ||
expectation = Expectation.UNDEFINED; | ||
@@ -111,3 +111,3 @@ } | ||
&& !((unaryOperators.includes(token)) && (!parsedString.trim() || previousToken === "(" || this.allowedOperators.has(previousToken)))) { | ||
parseOutput.errorString = `Please use ${this.variableType}${this.allowedNumbers ? " or numbers" : ""} after '${previousToken}'.`; | ||
parseOutput.errorString = `Please use ${this.variableType} ${this.variableType && this.allowedNumbers ? " or " : ''} ${this.allowedNumbers ? "numbers" : ""} after '${previousToken}'.`; | ||
expectation = Expectation.UNDEFINED; | ||
@@ -119,3 +119,3 @@ } | ||
else if (expectation === Expectation.OPERATOR && !isOperator && !isSpace && token != ")") { | ||
parseOutput.errorString = `Please use mathametical operators (${Array.from(this.allowedOperators).join(" ")}) after '${previousToken}'.`; | ||
parseOutput.errorString = `Please use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) after '${previousToken}'.`; | ||
expectation = Expectation.UNDEFINED; | ||
@@ -127,3 +127,3 @@ } | ||
else if (isNumber && previousToken === "/" && (this.variables.get(token) === 0 || Number(token) === 0)) { | ||
parseOutput.errorString = `Division by zero is not possible`; | ||
parseOutput.errorString = `Division by zero is not possible.`; | ||
expectation = Expectation.UNDEFINED; | ||
@@ -135,3 +135,3 @@ } | ||
else if (previousToken === "(" && token === ")") { | ||
parseOutput.errorString = `Pls do not use empty brackets ().`; | ||
parseOutput.errorString = `Please don't use empty brackets ().`; | ||
expectation = Expectation.UNDEFINED; | ||
@@ -169,3 +169,3 @@ } | ||
if (this.allowedOperators.has(previousToken)) { | ||
parseOutput.errorString = `Pls do not use mathametical operators (${Array.from(this.allowedOperators).join(",")}) at the end.`; | ||
parseOutput.errorString = `Please don't use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) at the end.`; | ||
} | ||
@@ -172,0 +172,0 @@ if (!parentheses.isEmpty()) { |
{ | ||
"name": "@fw-components/formula-editor", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "A WYSIWYG type formula editor", | ||
@@ -22,3 +22,3 @@ "main": "dist/formula-editor/src/formula-editor.js", | ||
"dependencies": { | ||
"@fw-components/styles": "^2.3.0", | ||
"@fw-components/styles": "^2.3.1", | ||
"big.js": "^6.2.1", | ||
@@ -35,3 +35,3 @@ "lit": "^2.1.2", | ||
}, | ||
"gitHead": "8d6a4d40e1207f2f71368aa140af51d134755508" | ||
"gitHead": "f563fb5a8936a1767f930a8d98a0fe686e963293" | ||
} |
69071
0Updated