From 1c2c0380ad21b1e74bda54acb48a422a3325febe Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 21 Jul 2023 22:34:20 +0000 Subject: [PATCH] Auto-generated commit --- .github/workflows/publish.yml | 2 +- CONTRIBUTORS | 19 ++++++++++++------- lib/main.js | 6 ++++-- package.json | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f56d473..26be02d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -197,7 +197,7 @@ jobs: # Publish package to npm: - name: 'Publish package to npm' - uses: JS-DevTools/npm-publish@v1 + uses: JS-DevTools/npm-publish@v2 with: token: ${{ secrets.NPM_TOKEN }} access: public diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a984439..93c4bde 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,32 +3,37 @@ # Contributors listed in alphabetical order. Ali Salesi +Amit Jimiwal Athan Reines Brendan Graetz Bruno Fenzl Christopher Dambamuromo +Dan Rose Dominik Moritz +Dorrin Sotoudeh Frank Kovacs -Harshita Kalani <95532771+HarshitaKalani@users.noreply.github.com> -James +Harshita Kalani +James Gelok Jithin KS Joey Reed -Jordan-Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> +Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison -Marcus +Marcus Fantham Matt Cochrane Milan Raj Momtchil Momtchev +Naresh Jagadeesan +Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Ognjen Jevremović Philipp Burckhardt -Pranav <85227306+Pranavchiku@users.noreply.github.com> +Pranav Goswami Ricky Reusser +Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> Ryan Seal Seyyed Parsa Neshaei Shraddheya Shendre Stephannie Jiménez Gacha Yernar Yergaziyev -dorrin-sot <59933477+dorrin-sot@users.noreply.github.com> orimiles5 <97595296+orimiles5@users.noreply.github.com> -rei2hu +rei2hu diff --git a/lib/main.js b/lib/main.js index 6ad0fb2..a16aa13 100644 --- a/lib/main.js +++ b/lib/main.js @@ -38,7 +38,7 @@ var isAllowedCast = require( '@stdlib/ndarray-base-assert-is-allowed-data-type-c var createBuffer = require( '@stdlib/ndarray-base-buffer' ); var getType = require( '@stdlib/ndarray-base-buffer-dtype' ); var arrayShape = require( '@stdlib/array-shape' ); -var flattenArray = require( '@stdlib/utils-flatten-array' ); +var flatten = require( '@stdlib/array-base-flatten' ); var format = require( '@stdlib/string-format' ); var isArrayLikeObject = require( './is_array_like_object.js' ); var getDefaults = require( './defaults.js' ); @@ -122,6 +122,7 @@ function array() { var ndims; var nopts; var opts; + var osh; var len; var ord; var FLG; @@ -280,6 +281,7 @@ function array() { len = buffer.length; } else if ( opts.flatten && isArray( buffer ) ) { shape = arrayShape( buffer ); + osh = shape; // cache a reference to the inferred shape ndims = shape.length; len = numel( shape ); } else { @@ -313,7 +315,7 @@ function array() { } } else if ( buffer ) { if ( btype === 'generic' && opts.flatten ) { - buffer = flattenArray( buffer ); + buffer = flatten( buffer, osh || arrayShape( buffer ), false ); } if ( buffer.length !== len ) { throw new RangeError( 'invalid arguments. Array shape is incompatible with provided data source. Number of data source elements does not match array shape.' ); diff --git a/package.json b/package.json index 946c211..3e43e18 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "url": "https://github.com/stdlib-js/stdlib/issues" }, "dependencies": { + "@stdlib/array-base-flatten": "github:stdlib-js/array-base-flatten#main", "@stdlib/array-shape": "^0.0.6", "@stdlib/assert-has-own-property": "^0.0.7", "@stdlib/assert-is-array": "^0.0.7", @@ -62,8 +63,7 @@ "@stdlib/ndarray-ctor": "^0.0.10", "@stdlib/ndarray-defaults": "github:stdlib-js/ndarray-defaults#main", "@stdlib/string-format": "^0.0.3", - "@stdlib/types": "^0.0.14", - "@stdlib/utils-flatten-array": "^0.0.7" + "@stdlib/types": "^0.0.14" }, "devDependencies": { "@stdlib/array-float32": "^0.0.6",