Funkin/source/funkin/util/tools/MapTools.hx

22 lines
472 B
Haxe
Raw Normal View History

2023-01-22 19:55:30 -05:00
package funkin.util.tools;
/**
* A static extension which provides utility functions for Maps.
*
* For example, add `using MapTools` then call `map.values()`.
*
* @see https://haxe.org/manual/lf-static-extension.html
*/
class MapTools
{
public static function values<K, T>(map:Map<K, T>):Array<T>
{
return [for (i in map.iterator()) i];
}
2023-04-10 16:05:37 -04:00
public static function keyValues<K, T>(map:Map<K, T>):Array<K>
{
return [for (i in map.keys()) i];
}
2023-01-22 19:55:30 -05:00
}