Skip to content

zipWithIndex

zipWithIndex(array) → array · Array

Pair each element with its zero-based index.

  • array (required): the array to index
utlx
zipWithIndex(["Apple", "Banana", "Cherry"])  // [["Apple", 0], ["Banana", 1], ["Cherry", 2]]
utlx
map(zipWithIndex($input.items), (pair) -> {
  lineNumber: pair[1] + 1,
  ...pair[0]
})

Released under AGPL-3.0.