mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 15:44:59 +00:00
Merge pull request #12712 from Eggwise/patch-1
Allow snake case in content type generator
This commit is contained in:
commit
5a845afdad
@ -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',
|
||||
|
||||
@ -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";
|
||||
};
|
||||
@ -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";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user