Skip to content

Commit 289cbe7

Browse files
committed
refactor: update _splitPrefixDesc
1 parent e2aa2a5 commit 289cbe7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/prepareCommitMsg.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ export function _cleanJoin(first: string, second: string) {
4141
* Require a colon to exist to detect type prefix. i.e. 'ci' will be considered a description, but
4242
* 'ci:' will be considered a prefix. This keeps the check simpler as we don't have to match against
4343
* every type and we don't have to check if we are part of a word e.g. 'circus'.
44+
*
45+
* Now also supports Jira number e.g. '[ABCD-123] my description'.
4446
*/
4547
function _splitPrefixDesc(value: string) {
46-
const [prefix, description] = value.includes(":") ? value.split(":") : ["", value];
48+
let prefix: string, description: string
49+
50+
if (value.includes(":")) {
51+
[prefix, description] = value.split(":")
52+
} else {
53+
[prefix, description] = ["", value]
54+
}
4755

4856
return { prefix, description }
4957
}

0 commit comments

Comments
 (0)