From 654ad41f2205cfb90489dd5a1e068a75975aadc0 Mon Sep 17 00:00:00 2001 From: JavaTypedScript Date: Sat, 27 Dec 2025 16:11:34 +0000 Subject: [PATCH 1/5] docs: improve doctests for ndarray instances in --- 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/ndarray/any-by/README.md | 31 ++++--------------- .../@stdlib/ndarray/any-by/docs/repl.txt | 8 ++--- .../ndarray/any-by/docs/types/index.d.ts | 30 ++++-------------- .../@stdlib/ndarray/any-by/lib/assign.js | 5 +-- .../@stdlib/ndarray/any-by/lib/index.js | 10 ++---- .../@stdlib/ndarray/any-by/lib/main.js | 5 +-- 6 files changed, 18 insertions(+), 71 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/any-by/README.md b/lib/node_modules/@stdlib/ndarray/any-by/README.md index 489f2dfcb18a..b51ad07f3dc4 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/README.md +++ b/lib/node_modules/@stdlib/ndarray/any-by/README.md @@ -52,10 +52,7 @@ var x = array( [ [ 1.0, -2.0 ], [ 3.0, -4.0 ] ] ); // Test whether at least one element is positive: var out = anyBy( x, isPositive ); -// returns - -var v = out.get(); -// returns true +// returns [ true ] ``` The function accepts the following arguments: @@ -73,7 +70,6 @@ The function accepts the following options: By default, the function performs a reduction over all elements in a provided [`ndarray`][@stdlib/ndarray/ctor]. To reduce specific dimensions, set the `dims` option. ```javascript -var ndarray2array = require( '@stdlib/ndarray/to-array' ); var array = require( '@stdlib/ndarray/array' ); function isPositive( value ) { @@ -82,6 +78,7 @@ function isPositive( value ) { // Create an input ndarray: var x = array( [ [ 1.0, 2.0 ], [ -3.0, -4.0 ] ] ); +// returns var opts = { 'dims': [ 1 ] @@ -89,16 +86,12 @@ var opts = { // Perform reduction: var out = anyBy( x, opts, isPositive ); -// returns - -var v = ndarray2array( out ); -// returns [ true, false ] +// returns [ true, false ] ``` By default, the function returns an [`ndarray`][@stdlib/ndarray/ctor] having a shape matching only the non-reduced dimensions of the input [`ndarray`][@stdlib/ndarray/ctor] (i.e., the reduced dimensions are dropped). To include the reduced dimensions as singleton dimensions in the output [`ndarray`][@stdlib/ndarray/ctor], set the `keepdims` option to `true`. ```javascript -var ndarray2array = require( '@stdlib/ndarray/to-array' ); var array = require( '@stdlib/ndarray/array' ); function isPositive( value ) { @@ -114,10 +107,7 @@ var opts = { // Perform reduction: var out = anyBy( x, opts, isPositive ); -// returns - -var v = ndarray2array( out ); -// returns [ [ [ true ] ] ] +// returns [ [ [ true ] ] ] ``` To set the function execution context, provide a `thisArg`. @@ -141,10 +131,7 @@ var ctx = { // Perform reduction: var out = anyBy( x, isPositive, ctx ); -// returns - -var v = out.get(); -// returns true +// returns [ true ] var count = ctx.count; // returns 4 @@ -172,10 +159,7 @@ var y = empty( [], { // Perform reduction: var out = anyBy.assign( x, y, isPositive ); -// returns - -var v = out.get(); -// returns true +// returns [ true ] var bool = ( out === y ); // returns true @@ -222,9 +206,6 @@ var out = anyBy.assign( x, y, opts, predicate ); var bool = ( out === y ); // returns true - -var v = ndarray2array( y ); -// returns [ true, false ] ``` diff --git a/lib/node_modules/@stdlib/ndarray/any-by/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/any-by/docs/repl.txt index aecb2c595bbe..955c6fa1b679 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/docs/repl.txt +++ b/lib/node_modules/@stdlib/ndarray/any-by/docs/repl.txt @@ -38,9 +38,7 @@ > function f( v ) { return v > 0.0; }; > var out = {{alias}}( x, f ) - - > out.get() - true + [ true ] {{alias}}.assign( x, y[, options], predicate[, thisArg] ) @@ -84,11 +82,9 @@ > function f( v ) { return v > 0.0; }; > var out = {{alias}}.assign( x, y, f ) - + [ true ] > var bool = ( y === out ) true - > out.get() - true See Also -------- diff --git a/lib/node_modules/@stdlib/ndarray/any-by/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/any-by/docs/types/index.d.ts index f4e199cc124b..986e7e89c86f 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/any-by/docs/types/index.d.ts @@ -129,10 +129,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy( x, isPositive ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ = InputArray, ThisArg = unknown>( x: U, predicate: Predicate, thisArg?: ThisParameterType> ): boolndarray; @@ -172,10 +169,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy( x, {}, isPositive ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ = InputArray, ThisArg = unknown>( x: U, options: Options, predicate: Predicate, thisArg?: ThisParameterType> ): boolndarray; @@ -219,10 +213,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy.assign( x, y, isPositive ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ assign = InputArray, V extends ndarray = ndarray, ThisArg = unknown>( x: U, y: V, predicate: Predicate, thisArg?: ThisParameterType> ): V; @@ -268,10 +259,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy.assign( x, y, {}, isPositive ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ assign = InputArray, V extends ndarray = ndarray, ThisArg = unknown>( x: U, y: V, options: BaseOptions, predicate: Predicate, thisArg?: ThisParameterType> ): V; } @@ -312,10 +300,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy( x, isPositive ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -348,10 +333,7 @@ interface AnyBy { * * // Perform reduction: * var out = anyBy.assign( x, y, isPositive ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ declare var anyBy: AnyBy; diff --git a/lib/node_modules/@stdlib/ndarray/any-by/lib/assign.js b/lib/node_modules/@stdlib/ndarray/any-by/lib/assign.js index 5aa59b057486..901e5a69f2ce 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/lib/assign.js +++ b/lib/node_modules/@stdlib/ndarray/any-by/lib/assign.js @@ -81,13 +81,10 @@ var validate = require( './validate.js' ); * * // Perform reduction: * var out = assign( x, y, isPositive ); -* // returns +* // returns [ true] * * var bool = ( out === y ); * // returns true -* -* var v = out.get(); -* // returns true */ function assign( x, y, options, predicate, thisArg ) { var nargs; diff --git a/lib/node_modules/@stdlib/ndarray/any-by/lib/index.js b/lib/node_modules/@stdlib/ndarray/any-by/lib/index.js index e3d78f200281..d290a1af953b 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/lib/index.js +++ b/lib/node_modules/@stdlib/ndarray/any-by/lib/index.js @@ -49,10 +49,7 @@ * * // Perform reduction: * var out = anyBy( x, isPositive ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -86,10 +83,7 @@ * * // Perform reduction: * var out = anyBy.assign( x, y, isPositive ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/ndarray/any-by/lib/main.js b/lib/node_modules/@stdlib/ndarray/any-by/lib/main.js index c77897def246..3132dc800119 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/any-by/lib/main.js @@ -86,10 +86,7 @@ var validate = require( './validate.js' ); * * // Perform reduction: * var out = anyBy( x, isPositive ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ function anyBy( x, options, predicate, thisArg ) { var nargs; From 222a01424de306aa1e6e0d53e7d5beb033512a7b Mon Sep 17 00:00:00 2001 From: Rohit R Bhat Date: Sat, 27 Dec 2025 21:56:38 +0530 Subject: [PATCH 2/5] Fix return value format in anyBy README Update the return value example in README. Signed-off-by: Rohit R Bhat --- lib/node_modules/@stdlib/ndarray/any-by/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/any-by/README.md b/lib/node_modules/@stdlib/ndarray/any-by/README.md index b51ad07f3dc4..5e5a11776116 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/README.md +++ b/lib/node_modules/@stdlib/ndarray/any-by/README.md @@ -107,7 +107,7 @@ var opts = { // Perform reduction: var out = anyBy( x, opts, isPositive ); -// returns [ [ [ true ] ] ] +// returns [ [ [ [ true ] ] ] ] ``` To set the function execution context, provide a `thisArg`. From 1a5f828b0d7fdfb9c6ff626e9864169ee1e38e18 Mon Sep 17 00:00:00 2001 From: Rohit R Bhat Date: Sat, 27 Dec 2025 22:00:18 +0530 Subject: [PATCH 3/5] Update example output in README.md Signed-off-by: Rohit R Bhat --- lib/node_modules/@stdlib/ndarray/any-by/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/any-by/README.md b/lib/node_modules/@stdlib/ndarray/any-by/README.md index 5e5a11776116..ae059b7a7000 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/README.md +++ b/lib/node_modules/@stdlib/ndarray/any-by/README.md @@ -107,7 +107,7 @@ var opts = { // Perform reduction: var out = anyBy( x, opts, isPositive ); -// returns [ [ [ [ true ] ] ] ] +// returns [ [ true ] ] ``` To set the function execution context, provide a `thisArg`. From bd6bb2570e3d0223a20bde744c7236b1a187b46d Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 27 Dec 2025 13:53:12 -0800 Subject: [PATCH 4/5] docs: update example Signed-off-by: Athan --- lib/node_modules/@stdlib/ndarray/any-by/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/any-by/README.md b/lib/node_modules/@stdlib/ndarray/any-by/README.md index ae059b7a7000..3e0357909161 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/README.md +++ b/lib/node_modules/@stdlib/ndarray/any-by/README.md @@ -182,7 +182,6 @@ By default, the function performs a reduction over all elements in a provided [` ```javascript var array = require( '@stdlib/ndarray/array' ); var empty = require( '@stdlib/ndarray/empty' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); function predicate( value ) { return value > 0.0; From 7d3a12cc4eb0ad127b39a9a908ef9916860d8712 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 27 Dec 2025 13:54:21 -0800 Subject: [PATCH 5/5] docs: update example Signed-off-by: Athan --- lib/node_modules/@stdlib/ndarray/any-by/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/ndarray/any-by/README.md b/lib/node_modules/@stdlib/ndarray/any-by/README.md index 3e0357909161..d50353ce4b0b 100644 --- a/lib/node_modules/@stdlib/ndarray/any-by/README.md +++ b/lib/node_modules/@stdlib/ndarray/any-by/README.md @@ -202,6 +202,7 @@ var opts = { // Perform reduction: var out = anyBy.assign( x, y, opts, predicate ); +// returns [ true, false ] var bool = ( out === y ); // returns true