Created
January 29, 2021 17:18
-
-
Save 7rulnik/16f723d7259e8ac1d0628e751b0620f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getAllDependents(packageName) { | |
const packages = [] | |
let offset = 0 | |
let json | |
do { | |
const response = await fetch(`https://www.npmjs.com/browse/depended/${packageName}?offset=${offset}`, { | |
"headers": { | |
"x-spiferack": "1" | |
}, | |
}); | |
json = await response.json() | |
offset += json.paginationSize | |
packages.push(...json.packages) | |
} while (json.hasNext) | |
return packages | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment