DEV Community

Discussion on: ✔||🤢 Commit or Vomit | + cast

Collapse
 
malikkillian profile image
MalikKillian • Edited

A lot of people take issue with the fact it's uncommon. The operator is being used as intended so it doesn't bother me. However, it seems like this conversion is done from a free-form text field. Some sanitization needs to happen, so if that's done in the UI (like an input mask) this will work. If there is no sanitization then this code needs more logic so it can be resilient to garbage.

So, under the right circumstances I would commit this.