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

.slice(begin, [end]) => Wrapper #647

Closed
nhardy opened this issue Nov 2, 2016 · 2 comments
Closed

.slice(begin, [end]) => Wrapper #647

nhardy opened this issue Nov 2, 2016 · 2 comments

Comments

@nhardy
Copy link
Contributor

nhardy commented Nov 2, 2016

.slice(begin[, end]) => Wrapper

Returns a new wrapper with a subset of the nodes of the original wrapper, according to the rules of Array.prototype.slice.

Use Case

Currently:

wrapper.find(Component).forEach((item, index) => {
  if (index < 2) return;
  // Assertions
});

This would be a nice addition:

wrapper.find(Component).slice(2).forEach((item, index) => {
  // Assertions
});
@ljharb
Copy link
Member

ljharb commented Nov 2, 2016

I like it. This seems straightforward, as long as it conforms to Array#slice.

@nhardy
Copy link
Contributor Author

nhardy commented Nov 2, 2016

I'd be happy to submit a PR for this when I get some time this weekend.

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

No branches or pull requests

2 participants