Skip to content

Instantly share code, notes, and snippets.

@michaelrhodes
Created August 22, 2020 00:30
Show Gist options
  • Save michaelrhodes/20c6a7dfc812d35cd5afb05860c8b68e to your computer and use it in GitHub Desktop.
Save michaelrhodes/20c6a7dfc812d35cd5afb05860c8b68e to your computer and use it in GitHub Desktop.
convert an ipv4 address into its uint32 representation
ipv4.split('.').reduce((sum, num, ndx, arr) => sum + (num * Math.pow(256, arr.length - 1 - ndx)), 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment