mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-30 13:32:03 +03:00
Parse JSON on reception
This commit is contained in:
parent
0ec6075098
commit
e58d19290e
@ -9,7 +9,7 @@ function get(url) {
|
||||
data += chunk;
|
||||
});
|
||||
resp.on('end', () => {
|
||||
resolve(data);
|
||||
resolve(JSON.parse(data));
|
||||
});
|
||||
}).on("error", resolve);
|
||||
})
|
||||
@ -26,8 +26,8 @@ if (!packageName) {
|
||||
|
||||
async function downloadFiles() {
|
||||
const [elmJson, docsJson] = await Promise.all([
|
||||
get(`https://package.elm-lang.org/packages/${packageName}/latest/elm.json`).then(s => JSON.parse(s)),
|
||||
get(`https://package.elm-lang.org/packages/${packageName}/latest/docs.json`).then(s => JSON.parse(s))
|
||||
get(`https://package.elm-lang.org/packages/${packageName}/latest/elm.json`),
|
||||
get(`https://package.elm-lang.org/packages/${packageName}/latest/docs.json`)
|
||||
]);
|
||||
return [elmJson, docsJson];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user