Use native esm

This commit is contained in:
Jonathan Cremin 2020-01-18 10:19:20 +00:00
parent c4354a6600
commit 70bd12a4d6
37 changed files with 379 additions and 119 deletions

View file

@ -1,7 +1,7 @@
import { parse } from 'url';
import request from 'superagent';
import debuglog from 'debug';
import urlMatch from './url';
import urlMatch from './url.js';
const debug = debuglog('combine.fm:deezer');
@ -11,7 +11,7 @@ export function parseUrl(url) {
const matches = parse(url).path.match(/\/(album|track)[/]+([^/]+)/);
if (matches && matches[2]) {
return module.exports.lookupId(matches[2], matches[1]);
return lookupId(matches[2], matches[1]);
}
throw new Error();
}
@ -131,7 +131,7 @@ export async function search(data, original = {}) {
match = looseMatch(name, response.body.data, data.type, various);
}
return await module.exports.lookupId(response.body.data[0].id, type);
return await lookupId(response.body.data[0].id, type);
}
const matches = album.match(/^[^([]+/);
if (matches && matches[0] && matches[0] !== album) {
@ -141,7 +141,7 @@ export async function search(data, original = {}) {
} else if (type === 'track') {
cleanedData.albumName = matches[0].trim();
}
return await module.exports.search(cleanedData, data);
return await search(cleanedData, data);
}
return Promise.resolve({ service: 'deezer' });
}