import _parseFrcsSurveyFile from '../survey/parseFrcsSurveyFile' import _parseFrcsPlotFile from '../parseFrcsPlotFile' import _parseFrcsTripSummaryFile from '../parseFrcsTripSummaryFile' async function* linesOf(s: string): AsyncIterable { yield* s.split(/\r\n?|\n/gm) } const convertLineBased = ( fn: ( file: string, lines: AsyncIterable, ...rest: Rest ) => Promise ) => (file: string, str: string, ...rest: Rest): Promise => fn(file, linesOf(str), ...rest) const convertChunkBased = ( fn: ( file: string, lines: Iterable | AsyncIterable, ...rest: Rest ) => Promise ) => (file: string, str: string, ...rest: Rest): Promise => fn(file, [str], ...rest) export const parseFrcsSurveyFile = convertChunkBased(_parseFrcsSurveyFile) export const parseFrcsPlotFile = convertLineBased(_parseFrcsPlotFile) export const parseFrcsTripSummaryFile = convertLineBased( _parseFrcsTripSummaryFile )