Hack: How to convert a keyset to a vec

Date: 2020-03-17 | hack | hacklang | keyset | vec


problem

I've been using a lot more Hack / hacklang at work and have run into several cases where there's not great documentation. One of those cases is when trying to convert a keyset to a vec.

solution

To convert a keyset to a vec you can use the Vec\keys function from the standard library.

An example:

$my_keyset = keyset['a', 'b'];
$my_vec = Vec\keys($my_keyset);
-