maps: utility functions to extract keys, values, or both

Extracts from a map keys, values, or both to a properly typed array.