import { isFunction } from './isFunction' ; param array param predicate returns export function partition < T > ( array , predicate ) { if ( ! Array . isArray ( array ) ) throw new TypeError ( 'entries must be an array.' ) ; if ( ! isFunction ( predicate ) ) throw new TypeError ( 'predicate must be an function that returns a boolean value.' ) ; const partitionOne = [ ] ; const partitionTwo = [ ] ; for ( let i = 0 ; i < array . length ; i ++ ) { if ( predicate ( array [ i ] , i ) ) { partitionOne . push ( array [ i ] ) ; } else { partitionTwo . push ( array [ i ] ) ; } } return [ partitionOne , partitionTwo ] ; }