Skip to content
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 .slice method to retrieve a list of IPs within a block within a range #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdwheele
Copy link

@mdwheele mdwheele commented Oct 18, 2024

Hello!

💁 This PR adds a method to retrieve a subset of IP addresses within a block based on offset.

The primary reasoning for me putting this together was that in order to do this, I was having to either chain calls to .next(1) over and over or use .forEach to build a list of the IPs I needed based on offset.

Alternative Approaches

  • Instead of implementing .slice, we could instead provide an accessor that returns an array of all IP addresses within a block. With this, the client can apply whatever transform they want.

Remaining work

  • Add tests for "un-happy paths" (what happens when I slice out of range?)
  • Update documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant