mirror of https://github.com/portainer/portainer
15 lines
370 B
TypeScript
15 lines
370 B
TypeScript
import { NEW_LINE_BREAKER } from './constants';
|
|
import { FormattedLine } from './types';
|
|
|
|
type FormatFunc = (line: FormattedLine) => string;
|
|
|
|
export function concatLogsToString(
|
|
logs: FormattedLine[],
|
|
formatFunc: FormatFunc = (line) => line.line
|
|
) {
|
|
return logs.reduce(
|
|
(acc, formattedLine) => acc + formatFunc(formattedLine) + NEW_LINE_BREAKER,
|
|
''
|
|
);
|
|
}
|