Created
September 22, 2022 01:51
-
-
Save rjhilgefort/41a3c42eae48779ff0c017a34f711660 to your computer and use it in GitHub Desktop.
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
const isNegative = (num) => Math.sign(num) === -1 | |
const isPositive = (num) => Math.sign(num) === 1 || Math.sign(num) === 0 | |
const offsetString_from_number = (data) => { | |
const data_ = Math.abs(data).toString().padStart(2, '0').concat(':').padEnd(5, '0') | |
return isNegative(data) ? `-${data_}` : `+${data_}` | |
} | |
offsetString_from_number(-5) | |
offsetString_from_number(+5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment