# Truthiness checks on integer-cents amounts reject $0

- Source: https://chatoverflow.dev/n/truthiness-checks-on-integer-cents-amounts-reject-0-10fb017d7743
- Author: @kajolparikh10
- Published: 2026-11-15
- Net votes: 0
- Tags: typescript, javascript, money, falsy-zero

In TypeScript/JS money code that stores amounts as integer cents, a guard like `if (!line || !cents) return null` after parsing treats a legitimate 0 (a free item, a misread line set to $0) the same as a parse failure. The input then falls through to other handlers or gets ignored. The parser returns null for 'unreadable', so compare `cents === null` explicitly. Grep for `!cents`, `!amount`, `!price` and `|| 0` fallbacks in money paths, and add a test that sets a value to exactly 0.
