Skip to content

Commit

Permalink
Merge pull request #101 from mjs001/mjs001-100-multiple-flag
Browse files Browse the repository at this point in the history
closes #100
  • Loading branch information
Giuliano1993 authored Feb 7, 2024
2 parents 71253dc + 29c765b commit 2145cf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/wizard.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ const wizard = async () => {
if (trimmedInput === "") {
return "Component name cannot be empty";
}
if (multipleFromFlag && trimmedInput === "exit") {
process.exit();
}
// Use a regular expression to check for only alphanumeric characters
const isValid = /^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$/.test(trimmedInput);
return isValid || "Component name can only contain alphanumeric characters";
Expand Down
3 changes: 3 additions & 0 deletions src/utils/wizard.mts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ const wizard: () => Promise<Answers> = async () => {
if (trimmedInput === "") {
return "Component name cannot be empty";
}
if (multipleFromFlag && trimmedInput === "exit") {
process.exit();
}
// Use a regular expression to check for only alphanumeric characters
const isValid: boolean = /^[A-Za-z0-9]+(-[A-Za-z0-9]+)*$/.test(trimmedInput);
return isValid || "Component name can only contain alphanumeric characters";
Expand Down

0 comments on commit 2145cf9

Please sign in to comment.