import is from "is_js" ; export default ( type ) : 0 | 1 | 2 => { if ( is . boolean ( type ) ) { return 0 ; } if ( is . number ( type ) ) { if ( is . integer ( type ) ) { return 0 ; } else { return 1 ; } } if ( is . string ( type ) || is . array ( type ) || is . object ( type ) ) { return 2 ; } throw new Error ( `Invalid type "${ type }"` ) ; } ; export const size = function < T > ( items , iter , acc ) : number { if ( acc === undefined ) acc = 0 ; for ( let i = 0 ; i < items . length ; ++ i ) acc += iter ( items [ i ] , i , acc ) ; return acc ; } ;