diff --git a/package.json b/package.json index c797c44b9..543407889 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mon-entreprise", "license": "MIT", - "version": "1.2.3", + "version": "1.2.6", "description": "Library to compute the french social security contributions. Also a website that explains the calculations, and a generic engine to build cool forms that asks the question needed to compute an objective.", "main": "./dist/engine.js", "files": [ diff --git a/source/engine/index.js b/source/engine/index.js index a3168d45b..fe09942bb 100644 --- a/source/engine/index.js +++ b/source/engine/index.js @@ -28,12 +28,16 @@ class Engine { this.parsedRules = parseAll(rules) this.defaultValues = collectDefaults(rules) } - evaluate(targets, { defaultUnits, situation }) { + evaluate(targets, { defaultUnits, situation, withDefaultValues = true }) { this.evaluation = analyseMany( this.parsedRules, targets, defaultUnits - )(dottedName => situation[dottedName] || this.defaultValues[dottedName]) + )( + dottedName => + situation[dottedName] || + (withDefaultValues && this.defaultValues[dottedName]) + ) return this.evaluation.targets.map(({ nodeValue }) => nodeValue) } getLastEvaluationExplanations() {