Skip to content

difference

difference(arr1, arr2) → array · Array

Return values in arr1 that are NOT in arr2. Order matters — difference(a, b) is not the same as difference(b, a).

  • arr1 (required): the source array

  • arr2 (required): the array to subtract

utlx
difference([1, 2, 3], [2, 3, 4])           // [1]
difference([2, 3, 4], [1, 2, 3])           // [4]
utlx
let previous = map($input.previousOrders, (o) -> o.id)
let current = map($input.currentOrders, (o) -> o.id)
{
  newOrders: difference(current, previous),
  removedOrders: difference(previous, current)
}

Released under AGPL-3.0.