Created
October 26, 2016 14:22
-
-
Save imRohan/c09e0e5d227cf1eed9c48daa39aeb39e to your computer and use it in GitHub Desktop.
A simple function which take a value, and rounds it down to the nearest 0.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
formatAllotmentValue = (value) -> | |
_value = parseFloat(value) | |
if parseFloat((_value%(Math.floor(_value))).toFixed(1)) >= 0.5 | |
return Math.floor(_value) + 0.5 | |
else | |
return Math.floor(_value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment