0

I wrote the following code in Node.js:

    const axios = require("axios");
const prompt = require("prompt-sync")();

let numRepo = prompt("Welcome, How many repositories to search? ");
numRepo = parseInt(numRepo);
while (!Number.isInteger(numRepo))
  numRepo = parseInt(prompt("Please insert integer: "));
let n;
if (numRepo < 100) n = 1;
else n = numRepo % 100;

axios
  .get(
    `https://api.github.com/search/repositories?q=language:js&sort=stars&order=desc&per_page=${numRepo}&page=${n}`
  )
  .then((response) => {
    let repo = [];
    response.data.items.forEach((e) => repo.push(e));
    console.log(repo);


  })
  .catch((error) => {
    console.log(error);
  });

I used the GitHub Search APi, and my goal is to write a function whose purpose is to check for each repository how much unused packaged it has. How can this be done?

  • Does this answer your question? [Find unused npm packages in package.json](https://stackoverflow.com/questions/22675725/find-unused-npm-packages-in-package-json) – GOTO 0 Feb 22 '22 at 15:44
  • what's the use case here? wouldn't be better to check unused dependencies before pushing them to the remote repository? It could be a pre-push git hook. – Ruben Restrepo Mar 18 '22 at 15:47

0 Answers0