Skip to content

Commit bf82783

Browse files
committed
docs: update prepareCommitMsg.ts
1 parent 1c0ed3b commit bf82783

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/prepareCommitMsg.ts

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

38+
/*
39+
* Split message into prefix and description.
40+
*
41+
* Require a colon to exist to detect type prefix. i.e. 'ci' will be considered a description, but
42+
* 'ci:' will be considered a prefix. This keeps the check simpler as we don't have to match against
43+
* every type and we don't have to check if we are part of a word e.g. 'circus'.
44+
*/
3845
function _splitPrefixDesc(value: string) {
3946
return value.includes(":") ? value.split(":") : ["", value];
4047
}
4148

49+
/**
50+
* Split a prefix into a custom prefix and Conventional Commit type prefix.
51+
*/
4252
function _splitPrefixes(value: string) {
4353
return value.includes(" ")
4454
? value.split(" ", 2)
@@ -47,10 +57,6 @@ function _splitPrefixes(value: string) {
4757

4858
/**
4959
* Separate a message into a Conventional Commit type, if any, and the description.
50-
*
51-
* Require a colon to exist to detect type prefix. i.e. 'ci' will be considered a description, but
52-
* 'ci:' will be considered a prefix. This keeps the check simpler as we don't have to match against
53-
* every type and we don't have to check if we are part of a word e.g. 'circus'.
5460
*/
5561
export function _splitMsg(msg: string) {
5662
const [prefix, description] = _splitPrefixDesc(msg)

0 commit comments

Comments
 (0)