From 55a4f1fc869e41aca748c63d3018f0448b1606e0 Mon Sep 17 00:00:00 2001 From: pack Date: Sun, 9 Aug 2026 10:37:07 +0000 Subject: first commit --- node_modules/github-from-package/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 node_modules/github-from-package/index.js (limited to 'node_modules/github-from-package/index.js') diff --git a/node_modules/github-from-package/index.js b/node_modules/github-from-package/index.js new file mode 100644 index 0000000..3d1d657 --- /dev/null +++ b/node_modules/github-from-package/index.js @@ -0,0 +1,17 @@ +module.exports = function (pkg) { + var m; + if (m = match(JSON.stringify(pkg.repository))) { + return m; + } + else if (m = match(JSON.stringify(pkg))) { + return m; + } + return undefined; +}; + +function match (str) { + var m = /\bgithub.com[:\/]([^\/"]+)\/([^\/"]+)/.exec(str); + if (m) { + return 'https://github.com/' + m[1] + '/' + m[2].replace(/\.git$/, ''); + } +} -- cgit v1.2.3