-
-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add intToIp converter to network #360
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sign your commits with PGP
See: https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/managing-commit-signature-verification
@@ -8,6 +8,8 @@ and this project adheres to | |||
|
|||
## [Unreleased][unreleased] | |||
|
|||
- add intToIp converter to network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- add intToIp converter to network | |
- Add `intToIp` converter to `network.js` |
// Convert IPv4 address from string form to number form | ||
// Signature: IP_string | ||
// IP_string - <string>, (optional), default: '127.0.0.1', IPv4 address in string form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Convert IPv4 address from string form to number form | |
// Signature: IP_string | |
// IP_string - <string>, (optional), default: '127.0.0.1', IPv4 address in string form | |
// Convert IPv4 address from string form to number form | |
// Signature: [ip] | |
// ip - <string>, (optional), default: '127.0.0.1', IPv4 address in string form |
// Convert IPv4 address from number form to string form | ||
// Signature: IP_number | ||
// IP_number - <number>, (optional), default: 0, IPv4 address in number form |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Convert IPv4 address from number form to string form | |
// Signature: IP_number | |
// IP_number - <number>, (optional), default: 0, IPv4 address in number form | |
// Convert IPv4 address from number form to string form | |
// Signature: [ip] | |
// ip - <number>, (optional), default: 0, IPv4 address in number form |
const intToIp = (ipInt = 0) => | ||
[ipInt >>> 24, (ipInt >> 16) & 255, (ipInt >> 8) & 255, ipInt & 255].join( | ||
'.' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to put 4 parts of address into 4 separate variables and concatenate them without creating array and call join
npm run fmt
)npm run doc
to regenerate documentation based on comments)Unreleased
header in CHANGELOG.md