This can be collapsed into
```
value = Math.max(0, Math.min(1, value));