so maybe change the logic to make it clearer or explain in the comment?

If it was written like  `if (!value.length) { /* same code here */ }` I would understand the why :D