Hack: How to convert a keyset to a vec
Date: 2020-03-16 | hack | hacklang | keyset | vec |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
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 way to support my work is to like / comment / share for the algorithm and subscribe for future updates.