MAP
applies a function to every element in a collection and returns an array.
Function category: Collection​
MAP(arg1, arg2)
Arguments | Description |
| Function to be applied to the collection. |
| A collection. |
Let's say we're given a response with the following vehicle information:
{"data": {"fleet_prices": [16000,17450,9200],"fleet_names": ["bmw","audi","mercedes benz"]}}
If we want all of the values in fleet_names
to be capitalized, we can use MAP
with the UPPER
function.
# Capitalize values in a collectionMAP(FN(x,UPPER(x)), data.fleet_names)​# Returns ["BMW, "AUDI", "MERCEDES BENZ"]