forked from CorentinDieudonne/denzel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsandbox.js
More file actions
22 lines (19 loc) · 713 Bytes
/
sandbox.js
File metadata and controls
22 lines (19 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* eslint-disable no-console, no-process-exit */
const imdb = require('./src/imdb');
const DENZEL_IMDB_ID = 'nm0000243';
async function sandbox(actor) {
try {
console.log(`📽️ fetching filmography of ${actor}...`);
const movies = await imdb(actor);
const awesome = movies.filter(movie => movie.metascore >= 77);
console.log(`🍿 ${movies.length} movies found.`);
console.log(JSON.stringify(movies, null, 2));
console.log(`🥇 ${awesome.length} awesome movies found.`);
console.log(JSON.stringify(awesome, null, 2));
process.exit(0);
} catch (e) {
console.error(e);
process.exit(1);
}
}
sandbox(DENZEL_IMDB_ID);