Socket
Socket
Sign inDemoInstall

hosted-git-info

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hosted-git-info - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

24

index.js

@@ -78,2 +78,10 @@ "use strict"

var gitHostDefaults = {
"sshtemplate": "git@{domain}:{user}/{project}.git{#comittish}",
"sshurltemplate": "git+ssh://git@{domain}/{user}/{project}.git{#comittish}",
"browsetemplate": "https://{domain}/{user}/{project}{/tree/comittish}",
"docstemplate": "https://{domain}/{user}/{project}{/tree/comittish}#readme",
"httpstemplate": "https://{domain}/{user}/{project}.git{#comittish}",
"filetemplate": "https://{domain}/{user}/{project}/raw/{comittish}/{path}"
}
var gitHosts = {

@@ -108,3 +116,3 @@ github: {

"domain": "gist.github.com",
"pathmatch": /^[/](?:([^/]+)[/])?(\d+)(?:[.]git)?$/,
"pathmatch": /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
"filetemplate": "https://gist.githubusercontent.com/{user}/{project}/raw{/comittish}/{path}",

@@ -141,3 +149,3 @@ "bugstemplate": "https://{domain}/{project}",

GitHost.prototype._fill = function (template, vars) {
if (! template) throw new Error("BOOM")
if (!template) throw new Error("Tried to fill without template")
if (!vars) vars = {}

@@ -160,3 +168,3 @@ var self = this

GitHost.prototype.ssh = function () {
var sshtemplate = this.sshtemplate || "git@{domain}:{user}/{project}.git{#comittish}"
var sshtemplate = this.sshtemplate || gitHostDefaults.sshtemplate
return this._fill(sshtemplate)

@@ -166,3 +174,3 @@ }

GitHost.prototype.sshurl = function () {
var sshurltemplate = this.sshurltemplate || "git+ssh://git@{domain}/{user}/{project}.git{#comittish}"
var sshurltemplate = this.sshurltemplate || gitHostDefaults.sshurltemplate
return this._fill(sshurltemplate)

@@ -172,3 +180,3 @@ }

GitHost.prototype.browse = function () {
var browsetemplate = this.browsetemplate || "https://{domain}/{user}/{project}{/tree/comittish}"
var browsetemplate = this.browsetemplate || gitHostDefaults.browsetemplate
return this._fill(browsetemplate)

@@ -178,3 +186,3 @@ }

GitHost.prototype.docs = function () {
var docstemplate = this.docstemplate || "https://{domain}/{user}/{project}{/tree/comittish}#readme"
var docstemplate = this.docstemplate || gitHostDefaults.docstemplate
return this._fill(docstemplate)

@@ -189,3 +197,3 @@ }

GitHost.prototype.https = function () {
var httpstemplate = this.httpstemplate || "https://{domain}/{user}/{project}.git{#comittish}"
var httpstemplate = this.httpstemplate || gitHostDefaults.httpstemplate
return this._fill(httpstemplate)

@@ -200,3 +208,3 @@ }

GitHost.prototype.file = function (P) {
var filetemplate = this.filetemplate || "https://{domain}/{user}/{project}/raw/{comittish}/{path}"
var filetemplate = this.filetemplate || gitHostDefaults.filetemplate
return this._fill(filetemplate, {

@@ -203,0 +211,0 @@ path: P.replace(/^[/]+/g, "")

{
"name": "hosted-git-info",
"version": "1.5.2",
"version": "1.5.3",
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,2 +26,6 @@ "use strict"

verify("git@gist.github.com:222.git", "git@")
var hostinfo = HostedGit.fromUrl("git@gist.github.com:/ef860c7z5e0de3179341.git")
if (t.ok(hostinfo, "git@hex")) {
t.is( hostinfo.https(), "https://gist.github.com/ef860c7z5e0de3179341.git", "git@hex -> https" )
}
verify("git@gist.github.com:/222.git", "git@/")

@@ -28,0 +32,0 @@ verify("git://gist.github.com/222", "git")

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc