More logical validate names
This commit is contained in:
parent
e28d89f686
commit
4b186f1654
1 changed files with 4 additions and 4 deletions
|
@ -86,7 +86,7 @@ async function addDesign() {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'What name would you like the design to have? ([a-z] only)',
|
message: 'What name would you like the design to have? ([a-z] only)',
|
||||||
validate: validateNameDesign,
|
validate: validateDesignName,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (name && type) {
|
if (name && type) {
|
||||||
|
@ -159,7 +159,7 @@ async function addPlugin() {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
message: 'What name would you like the plugin to have? ([a-z] only)',
|
message: 'What name would you like the plugin to have? ([a-z] only)',
|
||||||
validate: validateNamePlugin,
|
validate: validatePluginName,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
@ -213,7 +213,7 @@ async function addPlugin() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateNameDesign(name) {
|
function validateDesignName(name) {
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
...Object.keys(designs.accessories),
|
...Object.keys(designs.accessories),
|
||||||
|
@ -228,7 +228,7 @@ function validateNameDesign(name) {
|
||||||
else return ' 🙈 Please use only [a-z], no spaces, no capitals, no nothing 🤷'
|
else return ' 🙈 Please use only [a-z], no spaces, no capitals, no nothing 🤷'
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateNamePlugin(name) {
|
function validatePluginName(name) {
|
||||||
const pluginName = 'plugin-' + name
|
const pluginName = 'plugin-' + name
|
||||||
if ([...Object.keys(plugins)].indexOf(pluginName) !== -1)
|
if ([...Object.keys(plugins)].indexOf(pluginName) !== -1)
|
||||||
return `Sorry but ${pluginName} is already taken so you'll need to pick something else`
|
return `Sorry but ${pluginName} is already taken so you'll need to pick something else`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue