Hack: How to convert a keyset to a vec

Date: 2020-03-16 | 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);

Want more like this?

The best / easiest way to support my work is by subscribing for future updates and sharing with your network.