From a03d529ec2890c2cbd5db2f8437616fb2a067911 Mon Sep 17 00:00:00 2001 From: kaushal-kumar-it Date: Sat, 27 Dec 2025 11:27:36 +0530 Subject: [PATCH 1/3] 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/some/README.md | 27 ++++--------------- .../@stdlib/ndarray/some/docs/repl.txt | 15 +++-------- .../ndarray/some/docs/types/index.d.ts | 20 +++----------- .../@stdlib/ndarray/some/lib/assign.js | 5 +--- .../@stdlib/ndarray/some/lib/index.js | 10 ++----- .../@stdlib/ndarray/some/lib/main.js | 5 +--- 6 files changed, 16 insertions(+), 66 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/some/README.md b/lib/node_modules/@stdlib/ndarray/some/README.md index 78e239048160..d10f39e709ba 100644 --- a/lib/node_modules/@stdlib/ndarray/some/README.md +++ b/lib/node_modules/@stdlib/ndarray/some/README.md @@ -49,10 +49,7 @@ var x = array( [ [ [ 1.0, 0.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] ); // Perform reduction: var out = some( x, 3 ); -// returns - -var v= out.get(); -// returns true +// returns [ true ] ``` The function accepts the following arguments: @@ -82,17 +79,13 @@ var opts = { // Perform reduction: var out = some( x, 2, opts ); -// returns - -var v = ndarray2array( out ); -// returns [ true, true ] +// returns [ true, true ] ``` 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 array = require( '@stdlib/ndarray/array' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); // Create an input ndarray: var x = array( [ [ [ 1.0, 0.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] ); @@ -105,10 +98,7 @@ var opts = { // Perform reduction: var out = some( x, 2, opts ); -// returns - -var v = ndarray2array( out ); -// returns [ [ [ true, true ] ] ] +// returns [ [ [ true, true ] ] ] ``` #### some.assign( x, n, out\[, options] ) @@ -130,13 +120,10 @@ var y = empty( [], { // Perform reduction: var out = some.assign( x, 3, y ); -// returns +// returns [ true ] var bool = ( out === y ); // returns true - -var v = y.get(); -// returns true ``` The function accepts the following arguments: @@ -155,7 +142,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' ); // Create an input ndarray: var x = array( [ [ [ 1.0, 0.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] ); @@ -172,13 +158,10 @@ var opts = { // Perform reduction: var out = some.assign( x, 2, y, opts ); -// returns +// returns [ true, true ] var bool = ( out === y ); // returns true - -var v = ndarray2array( out ); -// returns [ true, true ] ``` diff --git a/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt index 23a26de4734a..b4a8fdd89d96 100644 --- a/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt +++ b/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt @@ -35,15 +35,9 @@ -------- > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 0 ], [ 3, 4 ] ] ); > var y = {{alias}}( x, 3 ) - - > y.get() - true + [ true ] > y = {{alias}}( x, 3, { 'keepdims': true } ) - - > {{alias:@stdlib/ndarray/to-array}}( y ) - [ [ true ] ] - > y.get( 0, 0 ) - true + [ [ true ] ] {{alias}}.assign( x, n, y[, options] ) @@ -82,12 +76,9 @@ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 0 ], [ 3, 4 ] ] ); > var y = {{alias:@stdlib/ndarray/from-scalar}}( false ); > var out = {{alias}}.assign( x, 3, y ) - + [ true ] > var bool = ( out === y ) true - > y.get() - true - See Also -------- diff --git a/lib/node_modules/@stdlib/ndarray/some/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/some/docs/types/index.d.ts index 71778579ea54..fc6ab902e58b 100644 --- a/lib/node_modules/@stdlib/ndarray/some/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/some/docs/types/index.d.ts @@ -81,10 +81,7 @@ interface Some { * * // Perform reduction: * var out = some( x, 3 ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ ( x: InputArray, n: integerndarray | number, options?: Options ): boolndarray; @@ -124,10 +121,7 @@ interface Some { * * // Perform reduction: * var out = some.assign( x, 3, y ); - * // returns - * - * var v = out.get(); - * // returns true + * // returns [ true ] */ assign( x: InputArray, n: integerndarray | number, y: T, options?: BaseOptions ): T; } @@ -161,10 +155,7 @@ interface Some { * * // Perform reduction: * var out = some( x, 3 ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -193,10 +184,7 @@ interface Some { * * // Perform reduction: * var out = some.assign( x, 3, y ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ declare var some: Some; diff --git a/lib/node_modules/@stdlib/ndarray/some/lib/assign.js b/lib/node_modules/@stdlib/ndarray/some/lib/assign.js index 45e6e929d5ef..b0247ece26dd 100644 --- a/lib/node_modules/@stdlib/ndarray/some/lib/assign.js +++ b/lib/node_modules/@stdlib/ndarray/some/lib/assign.js @@ -88,10 +88,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' ); * * // Perform reduction: * var out = assign( x, 6, y ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ function assign( x, n, y, options ) { var opts; diff --git a/lib/node_modules/@stdlib/ndarray/some/lib/index.js b/lib/node_modules/@stdlib/ndarray/some/lib/index.js index 04fb70a232e6..28b179c96e0f 100644 --- a/lib/node_modules/@stdlib/ndarray/some/lib/index.js +++ b/lib/node_modules/@stdlib/ndarray/some/lib/index.js @@ -45,10 +45,7 @@ * * // Perform reduction: * var out = some( x, 6 ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -78,10 +75,7 @@ * * // Perform reduction: * var out = some.assign( x, 6, y ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/ndarray/some/lib/main.js b/lib/node_modules/@stdlib/ndarray/some/lib/main.js index ff8182bff968..6563aa03d24e 100644 --- a/lib/node_modules/@stdlib/ndarray/some/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/some/lib/main.js @@ -91,10 +91,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' ); * * // Perform reduction: * var out = some( x, 3 ); -* // returns -* -* var v = out.get(); -* // returns true +* // returns [ true ] */ function some( x, n, options ) { var opts; From b1a16089c820f95b1f4f33fc61b4594c1529b86f Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 27 Dec 2025 00:13:27 -0800 Subject: [PATCH 2/3] docs: update example Signed-off-by: Athan --- lib/node_modules/@stdlib/ndarray/some/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/node_modules/@stdlib/ndarray/some/README.md b/lib/node_modules/@stdlib/ndarray/some/README.md index d10f39e709ba..7c483965229b 100644 --- a/lib/node_modules/@stdlib/ndarray/some/README.md +++ b/lib/node_modules/@stdlib/ndarray/some/README.md @@ -67,7 +67,6 @@ By default, the function performs a reduction over all elements in a provided [` ```javascript var array = require( '@stdlib/ndarray/array' ); -var ndarray2array = require( '@stdlib/ndarray/to-array' ); // Create an input ndarray: var x = array( [ [ [ 1.0, 0.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 0.0, 6.0 ] ] ] ); From 70534e8239fa282364ffb962dad9ea6a726d30c6 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 27 Dec 2025 00:14:41 -0800 Subject: [PATCH 3/3] style: add empty line Signed-off-by: Athan --- lib/node_modules/@stdlib/ndarray/some/docs/repl.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt index b4a8fdd89d96..3ac800f17373 100644 --- a/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt +++ b/lib/node_modules/@stdlib/ndarray/some/docs/repl.txt @@ -79,6 +79,7 @@ [ true ] > var bool = ( out === y ) true + See Also --------