From d9cb0512abdca695f42a816b6b997771bf898334 Mon Sep 17 00:00:00 2001 From: Payal Date: Thu, 2 Oct 2025 07:25:24 +0530 Subject: [PATCH 01/11] fix: require Object + remove new Array (lint #8183) --- lib/node_modules/@stdlib/stats/ztest/examples/index.js | 2 +- .../@stdlib/utils/nonenumerable-properties-in/lib/main.js | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/examples/index.js b/lib/node_modules/@stdlib/stats/ztest/examples/index.js index 64e5812f5f0f..5fad3ef54b9e 100644 --- a/lib/node_modules/@stdlib/stats/ztest/examples/index.js +++ b/lib/node_modules/@stdlib/stats/ztest/examples/index.js @@ -29,7 +29,7 @@ var i; rnorm = normal( 5.0, 4.0, { 'seed': 37827 }); -arr = new Array( 500 ); +arr = []; for ( i = 0; i < arr.length; i++ ) { arr[ i ] = rnorm(); } diff --git a/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js b/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js index 87ec784f74bf..7ea9dd0e53c1 100644 --- a/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js +++ b/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js @@ -40,17 +40,13 @@ var isNonEnumerable = require( '@stdlib/assert/is-nonenumerable-property' ); * // returns [...] */ function nonEnumerablePropertiesIn( value ) { + var Object = require( '@stdlib/object/ctor' ); var cache; var out; var obj; var tmp; var k; var i; - - if ( value === null || value === void 0 ) { - return []; - } - // Cast the value to an object: obj = Object( value ); // Walk the prototype chain collecting non-enumerable properties... From 9a7c78e1d3143975f224bf8170b896d93ae4132d Mon Sep 17 00:00:00 2001 From: Payal Date: Thu, 2 Oct 2025 07:39:58 +0530 Subject: [PATCH 02/11] fix-lint-errors-index.js-#8183 --- lib/node_modules/@stdlib/stats/ztest/examples/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/examples/index.js b/lib/node_modules/@stdlib/stats/ztest/examples/index.js index 5fad3ef54b9e..2896809a1af3 100644 --- a/lib/node_modules/@stdlib/stats/ztest/examples/index.js +++ b/lib/node_modules/@stdlib/stats/ztest/examples/index.js @@ -30,8 +30,8 @@ rnorm = normal( 5.0, 4.0, { 'seed': 37827 }); arr = []; -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = rnorm(); +for ( i = 0; i < 500; i++ ) { + arr.push( rnorm() ); } // Test whether true mean is equal to zero: From 5ca40601080a24c33319a7919bf87aa1ee646665 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 2 Oct 2025 12:52:15 -0700 Subject: [PATCH 03/11] fix: remove nested import Signed-off-by: Athan --- .../@stdlib/utils/nonenumerable-properties-in/lib/main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js b/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js index 7ea9dd0e53c1..f7fbff668376 100644 --- a/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js +++ b/lib/node_modules/@stdlib/utils/nonenumerable-properties-in/lib/main.js @@ -25,6 +25,7 @@ var getOwnPropertyNames = require( '@stdlib/utils/property-names' ); var getPrototypeOf = require( '@stdlib/utils/get-prototype-of' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isNonEnumerable = require( '@stdlib/assert/is-nonenumerable-property' ); +var Object = require( '@stdlib/object/ctor' ); // MAIN // @@ -40,13 +41,17 @@ var isNonEnumerable = require( '@stdlib/assert/is-nonenumerable-property' ); * // returns [...] */ function nonEnumerablePropertiesIn( value ) { - var Object = require( '@stdlib/object/ctor' ); var cache; var out; var obj; var tmp; var k; var i; + + if ( value === null || value === void 0 ) { + return []; + } + // Cast the value to an object: obj = Object( value ); // Walk the prototype chain collecting non-enumerable properties... From 115817a3d265ebae45ffe6cd82a7520f39f551e8 Mon Sep 17 00:00:00 2001 From: Athan Date: Thu, 2 Oct 2025 12:55:25 -0700 Subject: [PATCH 04/11] docs: update example Signed-off-by: Athan --- .../@stdlib/stats/ztest/examples/index.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/examples/index.js b/lib/node_modules/@stdlib/stats/ztest/examples/index.js index 2896809a1af3..7481d8da053e 100644 --- a/lib/node_modules/@stdlib/stats/ztest/examples/index.js +++ b/lib/node_modules/@stdlib/stats/ztest/examples/index.js @@ -18,24 +18,14 @@ 'use strict'; -var normal = require( '@stdlib/random/base/normal' ).factory; +var normal = require( '@stdlib/random/array/normal' ); var ztest = require( './../lib' ); -var rnorm; -var arr; -var out; -var i; - -rnorm = normal( 5.0, 4.0, { - 'seed': 37827 -}); -arr = []; -for ( i = 0; i < 500; i++ ) { - arr.push( rnorm() ); -} +// Create an array of random numbers: +var arr = normal( 500, 5.0, 4.0 ); // Test whether true mean is equal to zero: -out = ztest( arr, 4.0 ); +var out = ztest( arr, 4.0 ); console.log( out.print() ); // Test whether true mean is equal to five: From 23db2d3e0d8c86c3ad62e4349aa887d95131a5d1 Mon Sep 17 00:00:00 2001 From: Payal Date: Fri, 3 Oct 2025 11:56:38 +0530 Subject: [PATCH 05/11] docs: Update README examples to match index.js --- .../@stdlib/stats/ztest/README.md | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/README.md b/lib/node_modules/@stdlib/stats/ztest/README.md index d858564ef02b..0325f13a7563 100644 --- a/lib/node_modules/@stdlib/stats/ztest/README.md +++ b/lib/node_modules/@stdlib/stats/ztest/README.md @@ -35,19 +35,17 @@ var ztest = require( '@stdlib/stats/ztest' ); The function performs a one-sample z-test for the null hypothesis that the data in [array][mdn-array] or [typed array][mdn-typed-array] `x` is drawn from a normal distribution with mean zero and known standard deviation `sigma`. ```javascript -var normal = require( '@stdlib/random/base/normal' ).factory; +var normal = require( '@stdlib/random/array/normal' ); +var ztest = require( '@stdlib/stats/ztest' ); -var rnorm = normal( 0.0, 2.0, { +// Create an array of random numbers: +var arr = normal( 300, 0.0, 2.0, { 'seed': 5776 }); -var arr = new Array( 300 ); -var i; -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = rnorm(); -} - +// Test whether true mean is equal to 2.0: var out = ztest( arr, 2.0 ); + /* e.g., returns { 'rejected': false, @@ -204,23 +202,19 @@ table = out.print(); ```javascript -var normal = require( '@stdlib/random/base/normal' ).factory; +var normal = require( '@stdlib/random/array/normal' ); var ztest = require( '@stdlib/stats/ztest' ); -var rnorm; -var arr; -var out; -var i; - -rnorm = normal( 5.0, 4.0, { +// Create an array of random numbers: +var arr = normal( 500, 5.0, 4.0, { 'seed': 37827 }); -arr = new Array( 500 ); -for ( i = 0; i < arr.length; i++ ) { - arr[ i ] = rnorm(); -} -// Test whether true mean is equal to zero: +// Test whether true mean is equal to 4.0: +var out = ztest( arr, 4.0 ); + + +// Test whether true mean is equal to 4.0: out = ztest( arr, 4.0 ); console.log( out.print() ); /* e.g., => From 0b69798a747b454669034f41cc274b5a81d114f2 Mon Sep 17 00:00:00 2001 From: Payal Date: Fri, 3 Oct 2025 12:06:59 +0530 Subject: [PATCH 06/11] Updated comment in index.js --- lib/node_modules/@stdlib/stats/ztest/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/examples/index.js b/lib/node_modules/@stdlib/stats/ztest/examples/index.js index 7481d8da053e..69cc890880be 100644 --- a/lib/node_modules/@stdlib/stats/ztest/examples/index.js +++ b/lib/node_modules/@stdlib/stats/ztest/examples/index.js @@ -24,7 +24,7 @@ var ztest = require( './../lib' ); // Create an array of random numbers: var arr = normal( 500, 5.0, 4.0 ); -// Test whether true mean is equal to zero: +// Test whether true mean is equal to 4.0: var out = ztest( arr, 4.0 ); console.log( out.print() ); From dc90d448a4262e058bfb8b13f976ec8105209fcc Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 3 Oct 2025 11:16:20 -0700 Subject: [PATCH 07/11] docs: update examples Signed-off-by: Athan --- .../@stdlib/stats/ztest/README.md | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/README.md b/lib/node_modules/@stdlib/stats/ztest/README.md index 0325f13a7563..67c8d695066e 100644 --- a/lib/node_modules/@stdlib/stats/ztest/README.md +++ b/lib/node_modules/@stdlib/stats/ztest/README.md @@ -45,7 +45,6 @@ var arr = normal( 300, 0.0, 2.0, { // Test whether true mean is equal to 2.0: var out = ztest( arr, 2.0 ); - /* e.g., returns { 'rejected': false, @@ -88,16 +87,13 @@ The `ztest` function accepts the following `options`: By default, the hypothesis test is carried out at a significance level of `0.05`. To choose a different significance level, set the `alpha` option. ```javascript -var table; -var out; -var arr; - -arr = [ 2, 4, 3, 1, 0 ]; +var arr = [ 2, 4, 3, 1, 0 ]; -out = ztest( arr, 2.0, { +var out = ztest( arr, 2.0, { 'alpha': 0.01 }); -table = out.print(); + +var table = out.print(); /* e.g., returns One-sample z-test @@ -130,12 +126,9 @@ table = out.print(); To test whether the data comes from a distribution with a mean different than zero, set the `mu` option. ```javascript -var out; -var arr; - -arr = [ 4, 4, 6, 6, 5 ]; +var arr = [ 4, 4, 6, 6, 5 ]; -out = ztest( arr, 1.0, { +var out = ztest( arr, 1.0, { 'mu': 5.0 }); /* e.g., returns @@ -152,16 +145,13 @@ out = ztest( arr, 1.0, { By default, a two-sided test is performed. To perform either of the one-sided tests, set the `alternative` option to `less` or `greater`. ```javascript -var table; -var out; -var arr; +var arr = [ 4, 4, 6, 6, 5 ]; -arr = [ 4, 4, 6, 6, 5 ]; - -out = ztest( arr, 1.0, { +var out = ztest( arr, 1.0, { 'alternative': 'less' }); -table = out.print(); + +var table = out.print(); /* e.g., returns One-sample z-test @@ -212,10 +202,6 @@ var arr = normal( 500, 5.0, 4.0, { // Test whether true mean is equal to 4.0: var out = ztest( arr, 4.0 ); - - -// Test whether true mean is equal to 4.0: -out = ztest( arr, 4.0 ); console.log( out.print() ); /* e.g., => One-sample z-test From 475a22efaff82e686fd2c0fe8b17aabc5109d0d3 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 3 Oct 2025 11:17:37 -0700 Subject: [PATCH 08/11] docs: update examples Signed-off-by: Athan --- lib/node_modules/@stdlib/stats/ztest/README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/README.md b/lib/node_modules/@stdlib/stats/ztest/README.md index 67c8d695066e..5963b7b4941c 100644 --- a/lib/node_modules/@stdlib/stats/ztest/README.md +++ b/lib/node_modules/@stdlib/stats/ztest/README.md @@ -36,12 +36,9 @@ The function performs a one-sample z-test for the null hypothesis that the data ```javascript var normal = require( '@stdlib/random/array/normal' ); -var ztest = require( '@stdlib/stats/ztest' ); // Create an array of random numbers: -var arr = normal( 300, 0.0, 2.0, { - 'seed': 5776 -}); +var arr = normal( 300, 0.0, 2.0 ); // Test whether true mean is equal to 2.0: var out = ztest( arr, 2.0 ); @@ -49,7 +46,7 @@ var out = ztest( arr, 2.0 ); { 'rejected': false, 'pValue': ~0.155, - 'statistic': -1.422, + 'statistic': ~-1.422, 'ci': [~-0.391,~0.062], // ... } @@ -196,9 +193,7 @@ var normal = require( '@stdlib/random/array/normal' ); var ztest = require( '@stdlib/stats/ztest' ); // Create an array of random numbers: -var arr = normal( 500, 5.0, 4.0, { - 'seed': 37827 -}); +var arr = normal( 500, 5.0, 4.0 ); // Test whether true mean is equal to 4.0: var out = ztest( arr, 4.0 ); From 945a1e0677e756e925c1bb82904fc43b3cd5abff Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 3 Oct 2025 11:18:50 -0700 Subject: [PATCH 09/11] docs: update comment Signed-off-by: Athan --- lib/node_modules/@stdlib/stats/ztest/examples/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/examples/index.js b/lib/node_modules/@stdlib/stats/ztest/examples/index.js index 69cc890880be..31c5048639fa 100644 --- a/lib/node_modules/@stdlib/stats/ztest/examples/index.js +++ b/lib/node_modules/@stdlib/stats/ztest/examples/index.js @@ -28,7 +28,7 @@ var arr = normal( 500, 5.0, 4.0 ); var out = ztest( arr, 4.0 ); console.log( out.print() ); -// Test whether true mean is equal to five: +// Test whether true mean is equal to 5.0: out = ztest( arr, 4.0, { 'mu': 5.0 }); From 365a19739bda5315f62106d87130128d7df4a325 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 3 Oct 2025 11:21:27 -0700 Subject: [PATCH 10/11] docs: update examples Signed-off-by: Athan --- lib/node_modules/@stdlib/stats/ztest/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/README.md b/lib/node_modules/@stdlib/stats/ztest/README.md index 5963b7b4941c..fb08e746aac4 100644 --- a/lib/node_modules/@stdlib/stats/ztest/README.md +++ b/lib/node_modules/@stdlib/stats/ztest/README.md @@ -131,8 +131,8 @@ var out = ztest( arr, 1.0, { /* e.g., returns { 'rejected': false, - 'pValue': 1, - 'statistic': 0, + 'pValue': 1.0, + 'statistic': 0.0, 'ci': [ ~4.123, ~5.877 ], // ... } @@ -154,7 +154,7 @@ var table = out.print(); Alternative hypothesis: True mean is less than 0 - pValue: 1 + pValue: 1.0 statistic: 11.1803 95% confidence interval: [-Infinity,5.7356] @@ -170,7 +170,7 @@ table = out.print(); Alternative hypothesis: True mean is greater than 0 - pValue: 0 + pValue: 0.0 statistic: 11.1803 95% confidence interval: [4.2644,Infinity] @@ -195,7 +195,7 @@ var ztest = require( '@stdlib/stats/ztest' ); // Create an array of random numbers: var arr = normal( 500, 5.0, 4.0 ); -// Test whether true mean is equal to 4.0: +// Test whether true mean is equal to 0.0: var out = ztest( arr, 4.0 ); console.log( out.print() ); /* e.g., => @@ -203,14 +203,14 @@ console.log( out.print() ); Alternative hypothesis: True mean is not equal to 0 - pValue: 0 + pValue: 0.0 statistic: 28.6754 95% confidence interval: [4.779,5.4802] Test Decision: Reject null in favor of alternative at 5% significance level */ -// Test whether true mean is equal to five: +// Test whether true mean is equal to 5.0: out = ztest( arr, 4.0, { 'mu': 5.0 }); From 0b42241c1d6bf3e3042434b900d12658a77ad08b Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 3 Oct 2025 11:22:12 -0700 Subject: [PATCH 11/11] docs: fix comment Signed-off-by: Athan --- lib/node_modules/@stdlib/stats/ztest/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/ztest/README.md b/lib/node_modules/@stdlib/stats/ztest/README.md index fb08e746aac4..5263016e334c 100644 --- a/lib/node_modules/@stdlib/stats/ztest/README.md +++ b/lib/node_modules/@stdlib/stats/ztest/README.md @@ -40,7 +40,7 @@ var normal = require( '@stdlib/random/array/normal' ); // Create an array of random numbers: var arr = normal( 300, 0.0, 2.0 ); -// Test whether true mean is equal to 2.0: +// Test whether true mean is equal to 0.0: var out = ztest( arr, 2.0 ); /* e.g., returns {