From b77079943c690479b15a49bdddfddb1aaaabb445 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 9 May 2026 21:26:15 -0700 Subject: [PATCH 1/2] docs: improve doctests for complex number typed arrays in `ndarray/base/from-scalar` --- 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: na - 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 --- --- .../base/from-scalar/docs/types/index.d.ts | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts index 3ff7ef216d61..fdea58386ebe 100644 --- a/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts @@ -92,8 +92,6 @@ declare function scalar2ndarray( value: number, dtype: Float32DataType, order: O * var getDType = require( '@stdlib/ndarray/dtype' ); * * var Complex128 = require( '@stdlib/complex/float64/ctor' ); -* var real = require( '@stdlib/complex/float64/real' ); -* var imag = require( '@stdlib/complex/float64/imag' ); * * var v = new Complex128( 1.0, 2.0 ); * @@ -106,14 +104,8 @@ declare function scalar2ndarray( value: number, dtype: Float32DataType, order: O * var dt = String( getDType( x ) ); * // returns 'complex128' * -* var v = x.get(); -* // returns -* -* var re = real( v ); -* // returns 1.0 -* -* var im = imag( v ); -* // returns 2.0 +* var buf = x.data; +* // buf => [ 1.0, 2.0 ] */ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128DataType, order: Order ): complex128ndarray; @@ -134,8 +126,6 @@ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128D * var getDType = require( '@stdlib/ndarray/dtype' ); * * var Complex64 = require( '@stdlib/complex/float32/ctor' ); -* var realf = require( '@stdlib/complex/float32/real' ); -* var imagf = require( '@stdlib/complex/float32/imag' ); * * var v = new Complex64( 1.0, 2.0 ); * @@ -148,14 +138,8 @@ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128D * var dt = String( getDType( x ) ); * // returns 'complex64' * -* var v = x.get(); -* // returns -* -* var re = realf( v ); -* // returns 1.0 -* -* var im = imagf( v ); -* // returns 2.0 +* var buf = x.data; +* // buf => [ 1.0, 2.0 ] */ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex64DataType, order: Order ): complex64ndarray; From 52ba2afadc6b713c668abb1cb8aac8e028b2ad15 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 10 May 2026 04:19:31 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts index fdea58386ebe..9f190539d635 100644 --- a/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/ndarray/base/from-scalar/docs/types/index.d.ts @@ -90,6 +90,7 @@ declare function scalar2ndarray( value: number, dtype: Float32DataType, order: O * @example * var getShape = require( '@stdlib/ndarray/shape' ); * var getDType = require( '@stdlib/ndarray/dtype' ); +* var getData = require( '@stdlib/ndarray/data-buffer' ); * * var Complex128 = require( '@stdlib/complex/float64/ctor' ); * @@ -104,7 +105,7 @@ declare function scalar2ndarray( value: number, dtype: Float32DataType, order: O * var dt = String( getDType( x ) ); * // returns 'complex128' * -* var buf = x.data; +* var buf = getData( x ); * // buf => [ 1.0, 2.0 ] */ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128DataType, order: Order ): complex128ndarray; @@ -124,6 +125,7 @@ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128D * @example * var getShape = require( '@stdlib/ndarray/shape' ); * var getDType = require( '@stdlib/ndarray/dtype' ); +* var getData = require( '@stdlib/ndarray/data-buffer' ); * * var Complex64 = require( '@stdlib/complex/float32/ctor' ); * @@ -138,7 +140,7 @@ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex128D * var dt = String( getDType( x ) ); * // returns 'complex64' * -* var buf = x.data; +* var buf = getData( x ); * // buf => [ 1.0, 2.0 ] */ declare function scalar2ndarray( value: number | ComplexLike, dtype: Complex64DataType, order: Order ): complex64ndarray;