diff --git a/common/changes/@educorvi/rita/develop_2024-10-21-08-30.json b/common/changes/@educorvi/rita/develop_2024-10-21-08-30.json new file mode 100644 index 0000000..65c4f41 --- /dev/null +++ b/common/changes/@educorvi/rita/develop_2024-10-21-08-30.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@educorvi/rita", + "comment": "fix incorrect comparisons", + "type": "patch" + } + ], + "packageName": "@educorvi/rita" +} \ No newline at end of file diff --git a/rita-core/src/logicElements/Atom.ts b/rita-core/src/logicElements/Atom.ts index 1bb6f0c..981227c 100644 --- a/rita-core/src/logicElements/Atom.ts +++ b/rita-core/src/logicElements/Atom.ts @@ -58,7 +58,7 @@ export class Atom extends Formula { const k = a[i]; if (k in object) { object = object[k]; - } else if (defaultVal) { + } else if (defaultVal !== undefined) { return defaultVal; } else { throw new UndefinedPathError( @@ -96,7 +96,7 @@ export class Atom extends Formula { path: this.path, }; if (this.isDate) at['isDate'] = true; - if (this.defaultValue) at['default'] = this.defaultValue; + if (this.defaultValue !== undefined) at['default'] = this.defaultValue; return at; }