mirror of
https://github.com/strapi/strapi.git
synced 2025-12-30 00:37:24 +00:00
Add snake_case param for validating generate input
This commit is contained in:
parent
ec4bfad9fe
commit
79fd16cd23
@ -1,10 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = input => {
|
||||
const regex = /^[A-Za-z-]+$/g;
|
||||
module.exports = (input, allowSnakeCase = false) => {
|
||||
const regex = allowSnakeCase ? /^[A-Za-z-|_]+$/g : /^[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