function isArrayLike < T > ( items ) { return ( items as ArrayLike < T > ) . length != null ; } export function forEach < T > ( items , iterator ) { if ( isArrayLike ( items ) ) { for ( let i = 0 , len = items . length ; i < len ; i ++ ) { iterator ( items [ i ] ) ; } } else { for ( const item of items ) { iterator ( item ) ; } } } export function push < T > ( array , addition ) { forEach ( addition , ( a ) => array . push ( a ) ) ; } export function toArray < T > ( items ) { const results = [ ] as T [ ] ; for ( let i = 0 , len = items . length ; i < len ; i ++ ) { results . push ( items [ i ] ) ; } return results ; }