mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
26 lines
453 B
JavaScript
26 lines
453 B
JavaScript
// @flow
|
|
export type Description = {
|
|
title: string,
|
|
message: string
|
|
};
|
|
|
|
export function parseDescription(description?: string): Description {
|
|
const desc = description ? description : "";
|
|
const lineBreak = desc.indexOf("\n");
|
|
|
|
let title;
|
|
let message = "";
|
|
|
|
if (lineBreak > 0) {
|
|
title = desc.substring(0, lineBreak);
|
|
message = desc.substring(lineBreak + 1);
|
|
} else {
|
|
title = desc;
|
|
}
|
|
|
|
return {
|
|
title,
|
|
message
|
|
};
|
|
}
|