Skip to content

Commit

Permalink
[UPDATE] throw Error if provided arrays of varying dims.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Jun 9, 2015
1 parent 34e6e03 commit 59d268e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function toMatrix( arr, opts ) {
for ( i = 1; i < nRows; i++ ) {
for ( j = 0; j < nCols; j++ ) {
if ( arr[ i ].length !== nCols ) {
throw new TypeError( 'toMatrix()::invalid input argument. Every nested array must have the same length. Value: `' + arr + '`.' );
throw new Error( 'toMatrix()::invalid input argument. Every nested array must have the same length. Value: `' + arr + '`.' );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe( 'compute-to-matrix', function tests() {
});

it( 'should throw an error if provided nested arrays with varying dimensions', function test() {
expect( badValue ).to.throw( TypeError );
expect( badValue ).to.throw( Error );
function badValue() {
toMatrix( [[1,2,3],[4,5]] );
}
Expand Down

0 comments on commit 59d268e

Please sign in to comment.