remove leading/trailing whitespace&slashes

This commit is contained in:
anzz1 2022-10-01 20:09:45 +03:00 committed by GitHub
parent c87b9bf9e9
commit 53ac693d5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,6 +112,10 @@ function fetchAndShow(repo) {
repo = repo.replace('https://github.com/', '');
repo = repo.replace('http://github.com/', '');
repo = repo.replace(/\.git$/, '');
repo = repo.replace(/^\s+/,''); // remove leading whitespace
repo = repo.replace(/\s+$/,''); // remove trailing whitespace
repo = repo.replace(/^\/+/,''); // remove leading slashes
repo = repo.replace(/\/+$/,''); // remove trailing slashes
fetch(
`https://api.github.com/repos/${repo}/forks?sort=stargazers&per_page=100`