import { Arity2 , curry2 } from '@typed/functions' ; import { Index , List } from '../types' ; export const map = curry2 ( __map ) ; export type Map = { < A , B > ( f , list ) : Array < B > ; < A , B > ( f ) : ( list : List < A > ) => Array < B > ; } ; function __map < A , B > ( f , list ) { const itemCount = list . length ; const newList = Array ( itemCount ) ; for ( let i = 0 ; i < itemCount ; ++ i ) newList [ i ] = f ( list [ i ] , i ) ; return newList ; }