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