Skip to content

Commit df92e3c

Browse files
committed
refactor: update prepareCommitMsg.ts
1 parent dc39f33 commit df92e3c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/prepareCommitMsg.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,19 @@ function _splitPrefixDesc(value: string) {
5252
* Split a prefix into a custom prefix and Conventional Commit type prefix.
5353
*/
5454
function _splitPrefixes(value: string) {
55-
return value.includes(" ")
55+
const [customPrefix, typePrefix] = value.includes(" ")
5656
? value.split(" ", 2)
5757
: ["", value];
58+
59+
return { customPrefix, typePrefix }
5860
}
5961

6062
/**
6163
* Separate a message into a Conventional Commit type, if any, and the description.
6264
*/
6365
export function _splitMsg(msg: string) {
6466
const { prefix, description } = _splitPrefixDesc(msg)
65-
66-
const [customPrefix, typePrefix] = _splitPrefixes(prefix)
67+
const { customPrefix, typePrefix } = _splitPrefixes(prefix)
6768

6869
return { customPrefix, typePrefix, description: description.trim() };
6970
}

0 commit comments

Comments
 (0)