Skip to content

Commit

Permalink
fix(url): try to fix url for good
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Aug 28, 2017
1 parent dc34d24 commit 7da9daf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,20 @@ export function getDownloads(pkgs) {

export function getDependents(pkgs) {
return Promise.all(
pkgs.map(({ name }) => {
const startKey = JSON.stringify([name]);
const endKey = JSON.stringify([name, {}]);
return got(
`${c.npmRegistryEndpoint}/_design/app/_view/dependedUpon?startkey=${startKey}&endkey=${endKey}&stale=update_after`,
{ json: true }
)
pkgs.map(({ name }) =>
got(`${c.npmRegistryEndpoint}/_design/app/_view/dependedUpon`, {
json: true,
query: {
startKey: JSON.stringify([name]),
endKey: JSON.stringify([name, {}]),
stale: 'update_after',
},
})
.then(res => res.body.rows[0] || { value: 0 })
.then(({ value }) => ({
dependents: value,
humanDependents: numeral(value).format('0.[0]a'),
}));
})
}))
)
);
}

0 comments on commit 7da9daf

Please sign in to comment.