Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

DescriptionThis function takes arrays of the same length and returns an array of tuples that contain the values from the input arrays at the same indexes. This works similar to the Python zip() function.
Syntax


Code Block
sl.zip([array1], [array2],...)


Info

You can also use field parameters if they contain arrays of the same length, such as sl.zip($Alpha,$Beta).


Example

Expression: sl.zip([1, 2, 3], ['a', 'b', 'c'])

Result:

Code Block
[
      [
        1,
        "a"
      ],
      [
        2,
        "b"
      ],
      [
        3,
        "c"
      ]
    ]


zipObject

DescriptionThis function returns an object composed from key-value pairs that accepts two arrays, the first with the properties and the second with values. This works similar to the Lodash zipObject function.
Syntax


Code Block
sl.zipObject([props=[]], [values=[]])


Info

You can also use field parameters if they contain arrays of the different lengths, but extra key values are set to null.


Examples

Expression: sl.zipObject([1, 2], ['a', 'b'])

Result:

Code Block
{a: 1, b: 2}


Expression: sl.zipObject ([1,2],['a'])

Result

Code Block
{'1': 'a', '2': null}