export function removeMatching ( array , testFunc ) { let removeCnt = 0 ; let i = 0 ; while ( i < array . length ) { if ( testFunc ( array [ i ] ) ) { array . splice ( i , 1 ) ; removeCnt += 1 ; } else { i += 1 ; } } return removeCnt ; } export function removeExact ( array , exactVal ) { let removeCnt = 0 ; let i = 0 ; while ( i < array . length ) { if ( array [ i ] === exactVal ) { array . splice ( i , 1 ) ; removeCnt += 1 ; } else { i += 1 ; } } return removeCnt ; } export function isArraysEqual ( a0 , a1 , equalityFunc ? ) { if ( a0 === a1 ) { return true ; } let len = a0 . length ; let i ; if ( len !== a1 . length ) { return false ; } for ( i = 0 ; i < len ; i += 1 ) { if ( ! ( equalityFunc ? equalityFunc ( a0 [ i ] , a1 [ i ] ) : a0 [ i ] === a1 [ i ] ) ) { return false ; } } return true ; }