import type { Spectrum } from '../spectrum/Spectrum.js'; export interface GetMetadataOptions { /** * IDs of selected spectra */ ids?: string[]; } /** * Get metadata from spectra * @param spectra - Array of spectrum objects * @param options - Options for filtering spectra * @returns Array of metadata objects */ export function getMetadata( spectra: Spectrum[], options: GetMetadataOptions = {}, ): Array> { const { ids } = options; const metadata: Array> = []; if (Array.isArray(spectra) && spectra.length > 0) { for (const spectrum of spectra) { if (!ids || ids.includes(spectrum.id)) { metadata.push(spectrum.meta); } } } return metadata; }