Genericise the map JS.