whitequark / ipaddr.js

IP address manipulation library in JavaScript
MIT License
576 stars 92 forks source link

Adds TypeScript type guards for address versions #137

Closed Voronar closed 1 year ago

Voronar commented 4 years ago

Hi folks! Here are functions for more ergonomic typed programming.

const addr: IPv4 | IPv6 = parse('192.168.1.1');
if (isIPv4(addr)) {
  // addr: IPv4
} else {
  // addr: IPv6
}

if (isIPv6(addr)) {
  // addr: IPv6
} else {
  // addr: IPv4
}
whitequark commented 4 years ago

You don't have to message me in every way you can find, I get email for GitHub issues just fine.

whitequark commented 4 years ago

Just drop node 8, I think it's EOL

Voronar commented 4 years ago

Just drop node 8, I think it's EOL

Done. Ready for merging.

whitequark commented 4 years ago

Please update the Node requirement in README. Then, rebase the branch to contain two commits, Node/CI related changes and the TypeScript changes. After that I'll merge.

whitequark commented 1 year ago

I was very sick for a while and this fell off my radar, which unfortunately caused the PR to become unmergeable. Please comment here if you want to update the PR and I'll reopen it.