import { TypedArray } from '../types' ; /**
 * Tests a boolean expression and throws a message if false.
 */ export function assert ( expr , msg ) { if ( ! expr ) { throw new Error ( typeof msg === 'string' ? msg : msg ( ) ) ; } } export function assertShapesMatch ( shapeA , shapeB , errorMessagePrefix = '' ) { assert ( arraysEqual ( shapeA , shapeB ) , errorMessagePrefix + ` Shapes ${ shapeA } and ${ shapeB } must match` ) ; } export function arraysEqual ( n1 , n2 ) { if ( n1 . length !== n2 . length ) { return false ; } for ( let i = 0 ; i < n1 . length ; i ++ ) { if ( n1 [ i ] !== n2 [ i ] ) { return false ; } } return true ; } export const DECIMAL_PLACES_TO_CHECK = 4 ;