Skip to content

Commit

Permalink
Issue #1 is Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsalan Mughal Tekrevol committed Mar 15, 2024
1 parent 65de415 commit 703ea2b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ let answer = {
async function askValue(variableName, message) {
let result = await inquirer.prompt({
name: variableName,
type: 'number',
message
type: 'input',
message,
default() {
return 0;
},
validate: function (input) {
return isNaN(parseFloat(input)) ? 'You need to enter the number' : true;
}
});
answer[variableName] = result[variableName];
}
Expand Down
10 changes: 8 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ let answer:ANSWER_TYPE = {
async function askValue(variableName:VARIABLE_NAMES_TYPES, message:string){
let result = await inquirer.prompt({
name: variableName,
type: 'number',
message
type: 'input',
message,
default(){
return 0;
},
validate: function(input:any){
return isNaN(parseFloat(input)) ? 'You need to enter the number' : true;
}
});
answer[variableName] = result[variableName];
}
Expand Down

0 comments on commit 703ea2b

Please sign in to comment.