Created
October 20, 2020 05:39
-
-
Save suryapratap/29b73762ffc98a9f8e4379f4b3d9ef20 to your computer and use it in GitHub Desktop.
simple helper function to generate nip.io url from a given IPV4
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
function ip2nipHex(ipv4){ | |
return `http://${(ipv4.split('.').map(x=>parseInt(x).toString(16)).map(x=>('00'+x).substring(x.length)).join(''))}.nip.io`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment