import type { Spectrum } from '@zakodium/nmrium-core'; interface GetViewSpectraOptions { data: S[]; spectrumLiveProcessed: S | undefined; } /** * Return all spectra, with `spectrumLiveProcessed` replacing the related spectrum in data. */ export function getViewSpectra( state: GetViewSpectraOptions, ) { const { data, spectrumLiveProcessed } = state; if (!spectrumLiveProcessed) return data; return data.map((s) => s.id === spectrumLiveProcessed.id ? spectrumLiveProcessed : s, ); }