Created
September 22, 2022 01:51
-
-
Save rjhilgefort/41a3c42eae48779ff0c017a34f711660 to your computer and use it in GitHub Desktop.
Revisions
-
rjhilgefort created this gist
Sep 22, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ 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)