Skip to content

Commit a9f2471

Browse files
committed
test: add and update tests
--- 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 ---
1 parent aee31ef commit a9f2471

File tree

2 files changed

+993
-247
lines changed

2 files changed

+993
-247
lines changed

lib/node_modules/@stdlib/ndarray/flatten/lib/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var COL_MAJOR = 'column-major';
5151
* Returns a flattened copy of an input ndarray.
5252
*
5353
* @param {ndarray} x - input ndarray
54-
* @param {Object} [options] - function options
54+
* @param {Options} [options] - function options
5555
* @param {NonNegativeInteger} [options.depth] - maximum number of dimensions to flatten
5656
* @param {string} [options.order='row-major'] - order in which input ndarray elements should be flattened
5757
* @throws {TypeError} first argument must be an ndarray-like object
@@ -284,6 +284,7 @@ function flatten( x, options ) {
284284
var view;
285285
var opts;
286286
var xsh;
287+
var st;
287288
var o;
288289
var y;
289290

@@ -342,7 +343,8 @@ function flatten( x, options ) {
342343
});
343344

344345
// Create a view on top of output ndarray having the same shape as the input ndarray:
345-
view = ndarray( getDType( y ), getData( y ), xsh, shape2strides( xsh, opts.order ), 0, opts.order ); // eslint-disable-line max-len
346+
st = ( xsh.length > 0 ) ? shape2strides( xsh, opts.order ) : [ 0 ];
347+
view = ndarray( getDType( y ), getData( y ), xsh, st, 0, opts.order );
346348

347349
// Copy elements to the output ndarray:
348350
assign( [ x, view ] );

0 commit comments

Comments
 (0)