Is there a simple way to get the latter array from the former?
Source array :
[1, 2, 3, 4, 5]
Target structure:
[
{id: 1, text: idToName(1)},
{id: 2, text: idToName(2)},
{id: 3, text: idToName(3)},
{id: 4, text: idToName(4)},
{id: 5, text: idToName(5)}
]