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

feat: add iter/cunone #2616

Closed

Conversation

ruthwikchikoti
Copy link
Contributor

Resolves #2333.

Description

What is the purpose of this pull request?

This pull request:

  • Implements a new iterator function itercunone
  • Adds functionality to cumulatively test whether every iterated value is falsy
  • Enhances the stdlib iterator ecosystem

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

This implementation:

  • Takes an input iterator
  • Returns a new iterator that yields boolean values
  • Continues yielding true while all values are falsy
  • Yields false once a truthy value is encountered and for all subsequent iterations
  • Handles both iterable and non-iterable input iterators

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@ruthwikchikoti
Copy link
Contributor Author

@kgryte now can you review this !!!

@ruthwikchikoti
Copy link
Contributor Author

@kgryte review this ?

@kgryte kgryte changed the title #2613 resolved feat: add iter/cunone Jul 29, 2024
@kgryte kgryte added the Feature Issue or pull request for adding a new feature. label Jul 29, 2024
limitations under the License.

-->

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file needs updating. It does not match project conventions.

@@ -0,0 +1,96 @@
/** * @license Apache-2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how we do license headers.

@@ -0,0 +1,53 @@
{{alias}}( iterator )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how we format REPL text files.

* var bool = it.next().done;
* // returns true
*/
declare function iterCuNone( iterator: Iterator ): Iterator;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type can be improved. Use TypedIterator from types/iter.

* @returns iterator protocol-compliant object
*/
function iterator() {
return {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation.

// The compiler throws an error if the function is provided insufficient arguments...
{
iterCuNone(); // $ExpectError
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is clear that you did not follow the contributing guidelines and setup EditorConfig.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not have been changed. Revert the changes.

@@ -0,0 +1,85 @@
{
"name": "@stdlib/iter/cunone",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is off.

Comment on lines +25 to +30
"scripts": {
"test": "make test",
"test-cov": "make test-cov",
"examples": "make examples",
"benchmark": "make benchmark"
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be empty.

Comment on lines +40 to +52
"@stdlib/assert-is-iterator-like": "^0.0.x",
"@stdlib/symbol-iterator": "^0.0.x",
"@stdlib/types": "^0.0.x",
"@stdlib/utils-define-nonenumerable-read-only-property": "^0.0.x",
"@stdlib/error-tools-fmtprodmsg": "^0.0.x"
},
"devDependencies": {
"@stdlib/array-to-iterator": "^0.0.x",
"@stdlib/assert-is-boolean": "^0.0.x",
"@stdlib/random-iter-randu": "^0.0.x",
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
"istanbul": "^0.4.1",
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect.

});

tape( 'if an environment does not support `Symbol.iterator`, the returned iterator is not "iterable"', function test( t ) {
var iterCuNone;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

// Perform manual iteration...
var v;
while ( true ) {
v = result.next();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation.

Comment on lines +24 to +28
* @module @stdlib/iter-cunone
*
* @example
* var array2iterator = require( '@stdlib/array-to-iterator' );
* var iterCuNone = require( '@stdlib/iter-cunone' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect package names.

Comment on lines +98 to +101
if (v.done) {
return v;
}
if (FLG === false && v.value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing.

Comment on lines +94 to +95
var v;
var result;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect order.

if (v.done) {
return v;
}
if (FLG === false && v.value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FLG is undefined. This implementation won't work.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs significant changes in order to be further reviewed and considered for inclusion. Please read the project contributing guidelines. Based on the number of lint errors, it is clear that you did not setup your local dev environment for contributing to stdlib. Please ensure that you have rectified this before contributing further.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Jul 29, 2024
@kgryte kgryte added Stale Issue or pull request which has not been updated in an extended period of time. autoclose: Stale Pull request which should be auto-closed as considered stale. and removed Stale Issue or pull request which has not been updated in an extended period of time. labels Sep 27, 2024
@stdlib-bot
Copy link
Contributor

This pull request has been automatically closed because it has been inactive for an extended period after changes were requested. If you still wish to pursue this contribution, feel free to reopen the pull request or submit a new one.

We appreciate your interest in contributing to stdlib!

@stdlib-bot stdlib-bot closed this Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoclose: Stale Pull request which should be auto-closed as considered stale. Feature Issue or pull request for adding a new feature. Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: add @stdlib/iter/cunone
3 participants