Lava Filters - ToQuantity
Category:Numeric
Description:Many times you want to call Singularize and Pluralize to prefix a word with a
number; e.g. "2 requests", "3 men". ToQuantity prefixes the provided word with the number and
accordingly pluralizes or singularizes the word.
Input: "Person": {
"PhoneNumbers": [
{
"NumberFormatted": "(555) 555-5551"
},
{
"NumberFormatted": "(555) 555-5552"
},
{
"NumberFormatted": "(555) 555-5553"
}
]
}
Lava: {% assign phoneCount = Person.PhoneNumbers | Size %}
Ted has {{ 'phone number' | ToQuantity:phoneCount }}.
Output: Ted has 3 phone numbers.