Skip to content

Commit

Permalink
refactor: use base array assertion utility
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Sep 9, 2024
1 parent 6bbe26f commit 114f651
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var shape = require( '@stdlib/ndarray/base/shape' );
var hasEqualValuesIndexed = require( '@stdlib/array/base/assert/has-equal-values-indexed' );


// MAIN //
Expand All @@ -42,21 +43,7 @@ var shape = require( '@stdlib/ndarray/base/shape' );
* // returns true
*/
function hasEqualShape( x, y ) {
var xsh;
var ysh;
var i;

xsh = shape( x, false );
ysh = shape( y, false );
if ( xsh.length !== ysh.length ) {
return false;
}
for ( i = 0; i < xsh.length; i++ ) {
if ( xsh[ i ] !== ysh[ i ] ) {
return false;
}
}
return true;
return hasEqualValuesIndexed( shape( x, false ), shape( y, false ) );
}


Expand Down

0 comments on commit 114f651

Please sign in to comment.