UNPKG

1.25 kBJavaScriptView Raw
1
2const EMAIL_REGEX = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
3
4const REPLY = [{
5 name: 'nav',
6 type: 'list',
7 message: 'Options',
8 choices: [
9 {
10 name: 'Back',
11 value: 'back'
12 }, {
13 name: 'Reply',
14 value: 'reply'
15 }, {
16 name: 'Delete',
17 value: 'delete'
18 }, {
19 name: 'Home',
20 value: 'home'
21 }, {
22 name: 'Exit',
23 value: 'exit'
24 }
25 ]
26}]
27
28const HOME = [{
29 name: 'home',
30 type: 'list',
31 message: 'Home',
32 choices: ['Inbox', 'Settings', 'Re-Authorize', 'Exit']
33}]
34
35const CREATE = [{
36 type: 'input',
37 name: 'recipient',
38 message: 'Recipient',
39 validate (answer) {
40 if (EMAIL_REGEX.test(answer)) {
41 return true
42 }
43 return 'Not a valid email :('
44 }
45}, {
46 type: 'input',
47 name: 'subject',
48 message: 'Subject',
49 validate: (answer) => {
50 if (answer.length < 1) {
51 return 'Cannot be blank!'
52 }
53 return true
54 }
55}, {
56 type: 'input',
57 name: 'text',
58 message: 'Message',
59 validate: (answer) => {
60 if (answer.length < 1) {
61 return 'Cannot be blank!'
62 }
63 return true
64 }
65}]
66
67module.exports = {
68 REPLY,
69 HOME,
70 CREATE
71}