Skip to content
This repository was archived by the owner on Feb 3, 2022. It is now read-only.

Commit dbc4b5e

Browse files
committed
Simplify prompt for account details function.
1 parent 0a89878 commit dbc4b5e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/create-twilio-function/prompt.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
const inquirer = require('inquirer');
22

3+
function validateAccountSid(input) {
4+
if (input.startsWith('AC') || input === '') {
5+
return true;
6+
} else {
7+
return 'An Account SID starts with "AC".';
8+
}
9+
}
10+
311
async function promptForAccountDetails(config) {
412
if (config.skipCredentials) return {};
513
const questions = [];
@@ -9,9 +17,7 @@ async function promptForAccountDetails(config) {
917
name: 'accountSid',
1018
message: 'Twilio Account SID',
1119
validate: input => {
12-
return input.startsWith('AC') || input === ''
13-
? true
14-
: 'An Account SID starts with "AC".';
20+
return validateAccountSid(input);
1521
}
1622
});
1723
}

0 commit comments

Comments
 (0)