Skip to content

Commit 114f651

Browse files
committed
refactor: use base array assertion utility
1 parent 6bbe26f commit 114f651

File tree

1 file changed

+2
-15
lines changed
  • lib/node_modules/@stdlib/ndarray/base/assert/has-equal-shape/lib

1 file changed

+2
-15
lines changed

lib/node_modules/@stdlib/ndarray/base/assert/has-equal-shape/lib/main.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

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

2526

2627
// MAIN //
@@ -42,21 +43,7 @@ var shape = require( '@stdlib/ndarray/base/shape' );
4243
* // returns true
4344
*/
4445
function hasEqualShape( x, y ) {
45-
var xsh;
46-
var ysh;
47-
var i;
48-
49-
xsh = shape( x, false );
50-
ysh = shape( y, false );
51-
if ( xsh.length !== ysh.length ) {
52-
return false;
53-
}
54-
for ( i = 0; i < xsh.length; i++ ) {
55-
if ( xsh[ i ] !== ysh[ i ] ) {
56-
return false;
57-
}
58-
}
59-
return true;
46+
return hasEqualValuesIndexed( shape( x, false ), shape( y, false ) );
6047
}
6148

6249

0 commit comments

Comments
 (0)