Map.reverse
reverse() -> map
Description
Flip each key/value pair so that the values is the key, and the key is the value.
If duplicate keys are created, the latest one will overwrite all previous keys.
$map = { a: 1, b: 2, c: 1 } $flippedMap = $map.reverse() print($flippedMap) //= { 1: 'c', 2: 'b' }