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

Feature dropWhile dropUntil function #22

Closed
2 tasks done
ppeeou opened this issue Nov 26, 2021 · 0 comments · Fixed by #23 or #25
Closed
2 tasks done

Feature dropWhile dropUntil function #22

ppeeou opened this issue Nov 26, 2021 · 0 comments · Fixed by #23 or #25
Assignees
Labels
enhancement New feature or request

Comments

@ppeeou
Copy link
Member

ppeeou commented Nov 26, 2021

Suggestion

⭐ Suggestion

  • dropWhile(Lazy):
    Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are dropped until the value applied to f returns falsey.

  • dropUntil(Lazy):
    Returns Iterable/AsyncIterable excluding elements dropped from the beginning. Elements are deleted until the value applied to f returns truly. (It is deleted including the value applied as true.)

💻 Use Cases

const dropWhileIter = dropWhile(a => a < 5, [1,2,3,4,5,6,7,8,9,10]);
dropWhileIter.next(); // 5
dropWhileIter.next(); // 6
dropWhileIter.next(); // 7
dropWhileIter.next(); // 8
dropWhileIter.next(); // 9
dropWhileIter.next(); // 10

const dropUntilIter = dropUntil(a => a > 5, [1,2,3,4,5,6,7,8,9,10]);
dropUntilIter.next(); // 7
dropUntilIter.next(); // 8
dropUntilIter.next(); // 9
dropUntilIter.next(); // 10
@ppeeou ppeeou added enhancement New feature or request v0.3 labels Nov 26, 2021
@ppeeou ppeeou self-assigned this Nov 26, 2021
This was referenced Nov 26, 2021
ppeeou added a commit that referenced this issue Nov 28, 2021
feat: add `dropWhile` function
@ppeeou ppeeou reopened this Nov 28, 2021
@ppeeou ppeeou closed this as completed in #25 Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant