-
-
Notifications
You must be signed in to change notification settings - Fork 447
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/iter cunone #2613
Feature/iter cunone #2613
Conversation
Implement iterCuNone to create an iterator which cumulatively tests whether every iterated value is falsy. This new function: - Takes an input iterator - Returns a new iterator that yields boolean values - Continues yielding while all values are falsy - Yields once a truthy value is encountered - Handles both iterable and non-iterable input iterators Includes: - Main implementation - TypeScript typings - Tests - Benchmarks - Example usage - Documentation Closes stdlib-js#2333
## Usage | ||
|
||
```javascript | ||
var iterCuNone = require( '@stdlib/iter/cunone' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is incomplete.
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you have EditorConfig setup as documented in the dev guides.
The returned iterator immediately returns `false` upon encountering a truthy | ||
value, for all subsequent iterations. | ||
|
||
If provided an iterator which does not return any iterated values, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't correct.
return v; | ||
} | ||
if ( v.value ) { | ||
FLG = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is what we want. Once this is set, the iterator ends. We want the iterator to continue iterating so long as a source iterator has values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is a cumulative iterator so the iterator should have the same length as the source iterator.
@@ -0,0 +1,85 @@ | |||
{ | |||
"name": "@stdlib/iter-cunone", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package name is incorrect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stdlib/iter/cunone
@kgryte
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. You can confirm this by examining all other packages in the main project repository. In short, package names should match the directory path.
"bugs": { | ||
"url": "https://github.com/stdlib-js/stdlib/issues" | ||
}, | ||
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependencies and dev deps should not be present.
|
||
// MODULES // | ||
|
||
var setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these package names are incorrect. They should be names from the main project, not standalone pkg names. See other packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies here and elsewhere.
@@ -111,6 +111,76 @@ var objectKeys = require( '@stdlib/utils/keys' ); | |||
var kumaraswamy = require( '@stdlib/stats/base/dists/kumaraswamy' ); | |||
|
|||
console.log( objectKeys( kumaraswamy ) ); | |||
// Create a Kumaraswamy distribution object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should not be present in this PR.
@@ -22,3 +22,72 @@ var objectKeys = require( '@stdlib/utils/keys' ); | |||
var kumaraswamy = require( './../lib' ); | |||
|
|||
console.log( objectKeys( kumaraswamy ) ); | |||
// Create a Kumaraswamy distribution object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes should not be present in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply undo the Kumaraswamy changes in this PR, and this PR can be judged on its own merits, irrespective of #1632.
@ruthwikchikoti Did you mean to close this? If you need to make changes, just do so on this PR. |
@kgryte raising a new pr |
Resolves #2333.
Description
iterCuNone
Related Issues
@stdlib/iter/cunone
#2333Other
true
while all values are falsyfalse
once a truthy value is encounteredChecklist
@stdlib-js/reviewers