Skip to content

Commit 12552c5

Browse files
committed
refactor: apply suggestions from PR review
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent 6d48a4b commit 12552c5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/node_modules/@stdlib/stats/incr/wmean/lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function incrwmean() {
106106
* @private
107107
* @param {number} [x] - value
108108
* @param {NonNegativeNumber} [w] - weight
109-
* @throws {TypeError} must provide a nonnegative number as the weight
109+
* @throws {TypeError} second argument must be a nonnegative number
110110
* @returns {(number|null)} weighted mean or null
111111
*/
112112
function accumulator( x, w ) {
@@ -117,9 +117,9 @@ function incrwmean() {
117117
return mu;
118118
}
119119
if ( !isNonNegativeNumber( w ) ) {
120-
throw new TypeError( format( 'invalid argument. Must provide a nonnegative weight. Weight: `%s`.', w ) );
120+
throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative number. Value: `%s`.', w ) );
121121
}
122-
if (w === 0.0) {
122+
if ( w === 0.0 ) {
123123
return ( FLG === void 0 ) ? null : mu;
124124
}
125125
FLG = true;

lib/node_modules/@stdlib/stats/incr/wmean/test/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ tape( 'the initial accumulated value is `null`', function test( t ) {
4949
tape( 'the accumulator function ignores zero weights and only updates the mean after encountering a non-zero weight', function test( t ) {
5050
var acc = incrwmean();
5151
t.equal( acc(), null, 'returns expected value' );
52-
t.equal( acc( 2.0, 0.0 ), null, 'returns the previous accumulated mean' );
53-
t.equal( acc( 2.0, 2.0 ), 2.0, 'returns the current accumulated mean' );
54-
t.equal( acc( 5.0, 0.0 ), 2.0, 'returns the previous accumulated mean' );
52+
t.equal( acc( 2.0, 0.0 ), null, 'returns expected value' );
53+
t.equal( acc( 2.0, 2.0 ), 2.0, 'returns expected value' );
54+
t.equal( acc( 5.0, 0.0 ), 2.0, 'returns expected value' );
5555
t.end();
5656
});
5757

58-
tape( 'the function throws an error if not provided a nonnegative number', function test( t ) {
58+
tape( 'the accumulator function throws an error if provided a second argument which is not a nonnegative number', function test( t ) {
5959
var values;
6060
var acc;
6161
var i;

0 commit comments

Comments
 (0)