Skip to content

Commit 1c0ed3b

Browse files
committed
refactor: create _splitPrefixDesc
1 parent c64c7eb commit 1c0ed3b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/prepareCommitMsg.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export function _cleanJoin(first: string, second: string) {
3535
return `${first} ${second}`.trim();
3636
}
3737

38+
function _splitPrefixDesc(value: string) {
39+
return value.includes(":") ? value.split(":") : ["", value];
40+
}
41+
3842
function _splitPrefixes(value: string) {
3943
return value.includes(" ")
4044
? value.split(" ", 2)
@@ -49,7 +53,7 @@ function _splitPrefixes(value: string) {
4953
* every type and we don't have to check if we are part of a word e.g. 'circus'.
5054
*/
5155
export function _splitMsg(msg: string) {
52-
const [prefix, description] = msg.includes(":") ? msg.split(":") : ["", msg];
56+
const [prefix, description] = _splitPrefixDesc(msg)
5357

5458
const [customPrefix, typePrefix] = _splitPrefixes(prefix)
5559

0 commit comments

Comments
 (0)