Map()

Allows you to transform the elements of an array

Example:

array = [{ name: 'ana', age: 18 }, { name: 'ben': age: 20 }]
newArray = Map(array, {
    title: '@name'
}) 
// output is [{ title: 'ana' }, { title: 'ben' }]

Give the name of the property to be read starting with an @

If you have text after the property, put an @ at the end

Example:

array = [{ name: 'ana', age: 18 }, { name: 'ben': age: 20 }]
newArray = Map(array, {
    title: 'Name is @name@ and age is @age'
}) 

Of course, you can read the properties in depth:

array = [{ address: { city: 'paris', street: 'gambetta' } }]
newArray = Map(array, {
    title: '@address.city'
}) 

Last updated