Skip to content

Commit

Permalink
🐛 测试一次测测测测
Browse files Browse the repository at this point in the history
  • Loading branch information
tw93 committed Aug 11, 2020
1 parent 71e06ef commit ded5c47
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Expand Up @@ -14,7 +14,6 @@ const defaultConfig = {
types,
symbol: false,
skipQuestions: [''],
subjectMaxLength: 75,
subjectMinLength: 1
};

Expand Down Expand Up @@ -110,21 +109,20 @@ function createQuestions(config) {
when: !config.skipQuestions.includes('scope')
},
{
type: 'maxlength-input',
type: 'input',
name: 'subject',
message:
config.questions && config.questions.subject
? config.questions.subject
: '写一个简短的描述:',
maxLength: config.subjectMaxLength,
validate: function(value) {
const arr = value.split(' ');
const minLength = config.subjectMinLength;
console.log(arr);
const message = minLength > 1 ? `,长度不少于${minLength}` : '';
if (arr && arr.length > 1 && arr[0].length > 3 && arr[1].length >= minLength) {
return true;
}
return '必须输入有效的改动描述' + minLength > 1 ? `,最短为${minLength}` : '';
return `必须输入改动描述${message}`;
},
filter: (subject, answers) => formatHead({ ...answers, subject })
},
Expand Down

0 comments on commit ded5c47

Please sign in to comment.