Skip to content

Instantly share code, notes, and snippets.

@calderaro
Created February 8, 2019 06:30
Show Gist options
  • Select an option

  • Save calderaro/2fc3cc269b99dba6b1a84d55d375032f to your computer and use it in GitHub Desktop.

Select an option

Save calderaro/2fc3cc269b99dba6b1a84d55d375032f to your computer and use it in GitHub Desktop.
graph helper functions
const getBaseNumber = num => parseInt('1'.padEnd(String(num).length, '0'))
const roundNumber = num => Math.ceil(num / getBaseNumber(num)) * getBaseNumber(num)
const getNumberOfTicks = num => roundNumber(num) / getBaseNumber(num)
console.log(getBaseNumber(4500))
console.log(roundNumber(4800))
console.log('ticks: ', getNumberOfTicks(4500))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment