Merge pull request #12712 from Eggwise/patch-1

Allow snake case in content type generator
This commit is contained in:
Alexandre BODIN 2022-03-11 13:55:00 +01:00 committed by GitHub
commit 5a845afdad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,6 @@
'use strict';
const validateInput = require('../utils/validate-input');
const validateAttributeInput = require('../utils/validate-attribute-input');
const DEFAULT_TYPES = [
// advanced types
@ -50,7 +50,7 @@ module.exports = async inquirer => {
type: 'input',
name: 'attributeName',
message: 'Name of attribute',
validate: input => validateInput(input),
validate: input => validateAttributeInput(input),
},
{
type: 'list',

View File

@ -0,0 +1,11 @@
'use strict';
module.exports = (input) => {
const regex = /^[A-Za-z-|_]+$/g
if (!input) {
return "You must provide an input";
}
return regex.test(input) || "Please use only letters, '-', '_', and no spaces";
};

View File

@ -1,10 +1,10 @@
'use strict';
module.exports = input => {
module.exports = (input) => {
const regex = /^[A-Za-z-]+$/g;
if (!input) {
return 'You must provide an input';
return "You must provide an input";
}
return regex.test(input) || "Please use only letters, '-' and no spaces";