Switch to async/await

This commit is contained in:
Jonathan Cremin 2018-04-14 00:18:48 +01:00
parent 87459b2acc
commit 18021e0ef8
10 changed files with 53 additions and 8837 deletions

View file

@ -10,13 +10,13 @@ fs.readdirSync(path.join(__dirname, 'services')).forEach(function(file) {
}
});
export default function* (url) {
export default async function (url) {
let matchedService;
for (let service of services) {
matchedService = service.match(url);
if (matchedService) {
const result = yield service.parseUrl(url);
return yield service.lookupId(result.id, result.type);
const result = await service.parseUrl(url);
return await service.lookupId(result.id, result.type);
}
}
};