-
-
Notifications
You must be signed in to change notification settings - Fork 771
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 stats/incr/nanmminmax
#6422
base: develop
Are you sure you want to change the base?
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
||
# incrnanmminmax | ||
|
||
> Compute a moving minimum and maximum incrementally ignoring `NaN` 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.
> Compute a moving minimum and maximum incrementally ignoring `NaN` values. | |
> Compute a moving minimum and maximum incrementally, ignoring `NaN` values. |
|
||
<section class="related"> | ||
|
||
* * * |
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.
remove L135-145
|
||
<section class="links"> | ||
|
||
<!-- <related-links> --> |
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.
remove L154-168
var i; | ||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
f = incrnanmminmax( (i%5)+1 ); |
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.
f = incrnanmminmax( (i%5)+1 ); | |
f = incrnanmminmax( ( i%5 ) + 1 ); |
import { ArrayLike } from '@stdlib/types/array'; | ||
|
||
/** | ||
* If provided a value, the accumulator function returns updated minimum and maximum values. If not provided a value, the accumulator function returns the current minimum and maximum 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.
There is repetitive code in this file so please fix it.
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 have noticed that as well and didn't understand that too but this repetitive code is also present in mminmax
package as well.
* @param {number} [x] - new value | ||
* @returns {(ArrayLikeObject|null)} min/max array or null | ||
*/ | ||
function accumulator(x) { |
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.
function accumulator(x) { | |
function accumulator( x ) { |
* @returns {(ArrayLikeObject|null)} min/max array or null | ||
*/ | ||
function accumulator(x) { | ||
if (arguments.length === 0 || isnan(x)) { |
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.
if (arguments.length === 0 || isnan(x)) { | |
if ( arguments.length === 0 || isnan( x ) ) { |
if (arguments.length === 0 || isnan(x)) { | ||
return mminmax(); | ||
} | ||
return mminmax(x); |
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.
return mminmax(x); | |
return mminmax( x ); |
{ | ||
"name": "@stdlib/stats/incr/nanmminmax", | ||
"version": "0.0.0", | ||
"description": "Compute a moving minimum and maximum incrementally.", |
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.
"description": "Compute a moving minimum and maximum incrementally.", | |
"description": "Compute a moving minimum and maximum incrementally, ignoring `NaN` values.", |
]; | ||
|
||
for ( i = 0; i < values.length; i++ ) { | ||
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); |
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.
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); | |
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided '+values[ i ] ); |
Resolves #5596
Description
This pull request:
Related Issues
This pull request:
stats/incr/nanmminmax
#5596Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers