Implement a function countBy(array, iteratee) that generates an object with keys derived from the results of applying each element of the array to the iteratee function, where the values correspond to the frequency of each key returned by the iteratee, with iteratees supporting both functions and strings as properties.