-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
32 lines (28 loc) · 1.05 KB
/
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
const ora = require('ora');
module.exports = parameters => {
const spinner = ora('Loading ...').start();
if (typeof parameters.index === 'undefined') {
spinner.warn('--index required!');
return Promise.resolve();
}
if (typeof parameters.uncss === 'undefined') {
return Promise.resolve(parameters)
.then(require('./lib/scraper'))
.then(require('./lib/codes'))
.then(r => {
spinner.succeed('Success!');
return r;
});
} else {
if (typeof parameters.name === 'undefined' || typeof parameters.movie === 'undefined' || typeof parameters.category === 'undefined' || typeof parameters.categories === 'undefined') {
spinner.warn('--name --movie --category --categories required!');
return Promise.resolve();
}
return Promise.resolve(parameters)
.then(require('./lib/uncss'))
.then(r => {
spinner.succeed('Success!');
return r;
});
}
};