-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
35 lines (30 loc) · 781 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
var inquirer = require('inquirer');
const check = require('./check');
var questions = [
{
type: 'input',
name: 'plate',
message: "What is the vehicle's plate number?",
},
{
type: 'input',
name: 'vin',
message: "What is the vehicle's VIN number?",
},
{
type: 'input',
name: 'year',
message: "What's the first registration year?",
validate: year => {
if (year > 1769 && year < new Date().getFullYear()) {
return true;
}
return 'Please enter a valid year.';
},
},
];
(async function() {
const { plate, vin, year } = await inquirer.prompt(questions);
await check(plate, vin, year);
})();