finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
406 bytes
|
| Rev | Line | |
|---|
| [81bc7da] | 1 | module.exports = function (pkg) {
|
|---|
| 2 | var m;
|
|---|
| 3 | if (m = match(JSON.stringify(pkg.repository))) {
|
|---|
| 4 | return m;
|
|---|
| 5 | }
|
|---|
| 6 | else if (m = match(JSON.stringify(pkg))) {
|
|---|
| 7 | return m;
|
|---|
| 8 | }
|
|---|
| 9 | return undefined;
|
|---|
| 10 | };
|
|---|
| 11 |
|
|---|
| 12 | function match (str) {
|
|---|
| 13 | var m = /\bgithub.com[:\/]([^\/"]+)\/([^\/"]+)/.exec(str);
|
|---|
| 14 | if (m) {
|
|---|
| 15 | return 'https://github.com/' + m[1] + '/' + m[2].replace(/\.git$/, '');
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.