-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (39 loc) · 855 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
36
37
38
39
40
41
42
43
44
45
const arvish = require('arvish');
const Irverbs = require('irverbs/irverbs.js');
const fixtures = require('irverbs/irverbs.json').fixtures;
const args = process.argv.slice(2);
if (args.length < 1) {
return arvish.output([]);
}
const matches = new Irverbs(fixtures).find(args[0]);
if (matches.length === 0) {
return arvish.output([]);
}
const output = [
{
title: matches[0][0],
subtitle: 'Base Form',
arg: matches[0][0],
},
{
title: matches[0][1],
subtitle: 'Past Simple',
arg: matches[0][1],
},
{
title: matches[0][2],
subtitle: 'Past Participle',
arg: matches[0][2],
},
{
title: matches[0][3],
subtitle: '3rd Person Singular',
arg: matches[0][3],
},
{
title: matches[0][4],
subtitle: 'Present Participle / Gerund',
arg: matches[0][4],
},
];
arvish.output(output);