zip

Function zip 

Source
pub fn zip(
    _state: &State<'_, '_>,
    value: Value,
    others: Rest<Value>,
) -> Result<Value, Error>
Expand description

Zip multiple iterables into tuples.

This filter works like the Python zip function. It takes one or more iterables and returns an iterable of tuples where each tuple contains one element from each input iterable. The iteration stops when the shortest iterable is exhausted.

{{ [1, 2, 3]|zip(['a', 'b', 'c']) }}
-> [(1, 'a'), (2, 'b'), (3, 'c')]

{{ [1, 2]|zip(['a', 'b', 'c'], ['x', 'y', 'z']) }}
-> [(1, 'a', 'x'), (2, 'b', 'y')]