/** * @module array */ /** * * Calls a function on every item in an array and concatenates the resulting arrays into a single flat array. * * @typeparam TValue The type of items in the input array * @typeparam TNext the type of items in the output array * @param array The input array to be mapped * @param fn The functions used to generate the new items * @return A flat array of the resulting values * * @example * ```typescript * * const items = flatMap(['foo', 'bar'], word => word.split()) * // Returns ['f', 'o', 'o', 'b', 'a', 'r'] * ``` * */ export default function flatMap(array: TValue[], fn: (value: TValue, index?: number) => TNext[]): TNext[];