Skip to content

formatPlural

formatPlural(count, word) → string · String

Creates a formatted string with count and correctly pluralized word.

  • count (required): numeric count

  • word (required): singular form of the word

bash
echo '{"n": 3}' | utlx -e 'formatPlural($input.n, "item")'
# "3 items"
utlx
{
  summary: formatPlural(count($input.errors), "error"),
  files: formatPlural($input.fileCount, "file")
}

Released under AGPL-3.0.