diff --git a/changelog.md b/changelog.md index 8314c74..f9e9c8e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # illogical changelog +## 1.6.1 + +- Bugfix on Arithmetic evaluate. Returns false when ContextValue is not present in the Context. + ## 1.6.0 - Added support for Arithmetic expressions within other Comparison expressions. This allows for diff --git a/package-lock.json b/package-lock.json index 8112d5c..3cf7942 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@briza/illogical", - "version": "1.5.9", + "version": "1.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@briza/illogical", - "version": "1.5.9", + "version": "1.6.1", "license": "MIT", "devDependencies": { "@babel/core": "^7.25.2", diff --git a/package.json b/package.json index 79c9777..555209b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@briza/illogical", - "version": "1.6.0", + "version": "1.6.1", "description": "A micro conditional javascript engine used to parse the raw logical and comparison expressions, evaluate the expression in the given data context, and provide access to a text form of the given expressions.", "main": "lib/illogical.js", "module": "lib/illogical.esm.js", diff --git a/types/expression/arithmetic/index.d.ts b/types/expression/arithmetic/index.d.ts index 23c269c..a26a385 100644 --- a/types/expression/arithmetic/index.d.ts +++ b/types/expression/arithmetic/index.d.ts @@ -17,6 +17,16 @@ export declare abstract class Arithmetic implements Evaluable { * @param {Operand[]} operands Operands. */ constructor(operator: string, operatorSymbol: symbol, operands: Operand[]); + /** + * Helper function to assist with arithmetic evaluation. Ensures that all + * operands are present and are numbers. Throws error if any operand is not a + * number. + * + * @param {Result[]} results + * @returns {number[] | false} false if any operand is missing, otherwise the + * array of numbers + */ + protected getResultValues(results: Result[]): number[] | false; /** * Performs the arithmetic operation on the operands evaluated values. * @param {Result[]} results Operand result values.