transpose

Function: transpose()

Converts either:

  • an array of objects → an object of arrays
  • an object of arrays → an array of objects

Syntax

transpose(array/object)

ArgumentTypeDescription
array or object

Array

Object

The array or object to be converted.

Examples

transpose ( [ { "Invoice":108 } , { "Invoice":334 } ] )

Returns:

(  { "Invoice" : [ 108,334 ] }  )



transpose ( { "OnboardedYear" : [ 2015,2016 ] } )

Returns:

( [ { "OnboardedYear":2015 } , { "OnboardedYear":2016 } ] )