/** @module iterable/mapIterable.ts */ import { untypedCurry } from '../function/untypedCurry' /** * mapIterable */ export const _mapIterable = untypedCurry( ( fn, itr ) => { const arr: any[] = [] for ( const i of itr ) { arr.push( fn( i ) ) } return arr } ) export function mapIterable( fn: ( item: A ) => B, itr: Iterable | NodeListOf ): B[] export function mapIterable( fn: ( item: A ) => B ): ( itr: Iterable | NodeListOf ) => B[] /** * Takes a function f and an iterable i and returns an array with f mapped over i * :: ( f -> a -> b ) -> Iterable -> b[] */ export function mapIterable( ...args ) { return _mapIterable( ...args ) }