1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.getGitHubRepoSlug = void 0;
|
4 | function getGitHubRepoSlug(pkg) {
|
5 | let match = null;
|
6 | if (typeof pkg.repository === 'string') {
|
7 | match = pkg.repository.match(/^(?:github:)?([^/:]+\/[^/:]+)$/);
|
8 | }
|
9 | else {
|
10 | let url = null;
|
11 | if (pkg.repository && typeof pkg.repository.url === 'string') {
|
12 | url = pkg.repository && pkg.repository.url;
|
13 | }
|
14 | else if (typeof pkg.homepage === 'string') {
|
15 | url = pkg.homepage;
|
16 | }
|
17 | else {
|
18 | return null;
|
19 | }
|
20 | match = url.match(/github\.com\/([^/:]+\/[^/:]+?)(?:\.git|\/)?$/);
|
21 | }
|
22 | return (match && match[1]) || null;
|
23 | }
|
24 | exports.getGitHubRepoSlug = getGitHubRepoSlug;
|