// @deno-types="./flatten.d.ts" import flatten from './flatten.js'; // @deno-types="./map.d.ts" import map from './map.js'; /** * Maps the element to another type and flat. * * @template T element type * @template U another type * @param {Iterable.} iterable Iterable object. * @param {(value: T, index: number) => Iterable.} mapper Transformer function.(index origin is Zero) * @returns {Iterable.} The new iterable. Cannot reuse. */ export function flatMap( iterable: Iterable, mapper: (value: T, index: number) => Iterable ): Iterable { return flatten(map(iterable, mapper) as Iterable, 1); } export default flatMap;