InseeFr / Trevas-TS

JavaScript engine for the Validation and Transformation Language
MIT License
9 stars 8 forks source link

`nvl` with a value of `0` is not working as expected #135

Closed romaintailhurat closed 6 months ago

romaintailhurat commented 6 months ago

nvl(0, 10) should return 0 but actually returns 10, misinterpreting zero as null.

romaintailhurat commented 6 months ago

The bug is probably here.

Indeed, in JS:

12 ? 88 : 99 // → 88
0 ? 88 : 99 //  → 99

@NicoLaval agree ?

EDIT

Ref for falsy values