UNPKG

astro-integration-pocketbase

Version:

An Astro integration to support developers working with astro-loader-pocketbase.

15 lines (14 loc) 308 B
/** * Adds a value to an array in a map. If the key does not exist, it will be created. */ export function pushToMapArray<TKey, TArray>( map: Map<TKey, Array<TArray>>, key: TKey, value: TArray ): void { if (map.has(key)) { map.get(key)!.push(value); } else { map.set(key, [value]); } }