Skip to content

Commit 17d8548

Browse files
authored
fix: do not treat falsy values like 0 and false as undefined (#220)
1 parent 32c3fc1 commit 17d8548

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/experiment-core/src/evaluation/evaluation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class EvaluationEngine {
116116
// We need special matching for null properties and set type prop values
117117
// and operators. All other values are matched as strings, since the
118118
// filter values are always strings.
119-
if (!propValue) {
119+
if (propValue === undefined || propValue === null) {
120120
return this.matchNull(condition.op, condition.values);
121121
} else if (this.isSetOperator(condition.op)) {
122122
const propValueStringList = this.coerceStringArray(propValue);

packages/experiment-core/src/evaluation/select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const select = (
1111
}
1212
selectable = (selectable as Record<string, unknown>)[selectorElement];
1313
}
14-
if (!selectable) {
14+
if (selectable === undefined || selectable === null) {
1515
return undefined;
1616
} else {
1717
return selectable;

0 commit comments

Comments
 (0)