basant307/AI_Governance_Project
045
1module.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 12function 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}18 