map for javascript generators