In mustache I know how to write a function with arguments but I want to process a list of data through a function. So, my JSON data from an API call is as follows:
result = [{email: ‘[email protected]’, score1: 2, score2: 3},
{email: ‘[email protected]’, score1: 5, score2: 3},
{email: ‘[email protected]’, score1: 2, score2: 0}
]
Now, I actually want to repeat an image in html for the number stated in score1 and score2. So, in html I want to have 2 images of stars and 3 images of flames for 1st entry. Similarly, for the consecutive elements in the list.
The other way would be to iterate though the list and then assign a variable to be [1,2] in mustache. But, I want to avoid iterating as there would be too many records.
Please help me. Thanks in advance.