-
-
Notifications
You must be signed in to change notification settings - Fork 868
Closed
Labels
AcceptedRFC feature request which has been accepted.RFC feature request which has been accepted.FeatureIssue or pull request for adding a new feature.Issue or pull request for adding a new feature.Good First IssueA good first issue for new contributors!A good first issue for new contributors!JavaScriptIssue involves or relates to JavaScript.Issue involves or relates to JavaScript.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.difficulty: 2May require some initial design or R&D, but should be straightforward to resolve and/or implement.May require some initial design or R&D, but should be straightforward to resolve and/or implement.priority: NormalNormal priority concern or feature request.Normal priority concern or feature request.
Description
Description
This RFC proposes adding the package @stdlib/iter/cuany-by
, which cumulatively tests whether at least one iterated value passes a test implemented by a predicate function. The returned iterator should be a transform iterator, continuing to iterate while source iterator values are available.
var array2iterator = require( '@stdlib/array/to-iterator' );
function isPositive( value ) {
return ( value > 0 );
}
var arr = array2iterator( [ 0, 0, 0, 1, 0 ] );
var it = iterCuAnyBy( arr, isPositive );
var v = it.next().value;
// returns false
v = it.next().value;
// returns false
v = it.next().value;
// returns false
v = it.next().value;
// returns true
v = it.next().value;
// returns true
var bool = it.next().done;
// returns true
The predicate
function should be provided two arguments:
- value: the iterated value.
- index: iteration index (zero-based).
Related Issues
No.
Questions
No.
Other
- See also
@stdlib/iter/any-by
Checklist
- I have read and understood the Code of Conduct.
- Searched for existing issues and pull requests.
- The issue name begins with
RFC:
.
Metadata
Metadata
Assignees
Labels
AcceptedRFC feature request which has been accepted.RFC feature request which has been accepted.FeatureIssue or pull request for adding a new feature.Issue or pull request for adding a new feature.Good First IssueA good first issue for new contributors!A good first issue for new contributors!JavaScriptIssue involves or relates to JavaScript.Issue involves or relates to JavaScript.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.difficulty: 2May require some initial design or R&D, but should be straightforward to resolve and/or implement.May require some initial design or R&D, but should be straightforward to resolve and/or implement.priority: NormalNormal priority concern or feature request.Normal priority concern or feature request.