Socket
Socket
Sign inDemoInstall

github-url-to-object

Package Overview
Dependencies
1
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.1 to 1.0.0

5

index.js

@@ -13,2 +13,3 @@ "use strict"

var shorthand = repo_url.match(/^([\w-_]+)\/([\w-_\.]+)#?([\w-_\.]+)?$/)
var mediumhand = repo_url.match(/^github:([\w-_]+)\/([\w-_\.]+)#?([\w-_\.]+)?$/)
var antiquated = repo_url.match(/^git@[\w-_\.]+:([\w-_]+)\/([\w-_\.]+)$/)

@@ -20,2 +21,6 @@

obj.branch = shorthand[3] || "master"
} else if (mediumhand) {
obj.user = mediumhand[1]
obj.repo = mediumhand[2]
obj.branch = mediumhand[3] || "master"
} else if (antiquated) {

@@ -22,0 +27,0 @@ obj.user = antiquated[1]

2

package.json
{
"name": "github-url-to-object",
"version": "0.7.1",
"version": "1.0.0",
"description": "Extract user, repo, and other interesting properties from GitHub URLs",

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

@@ -22,2 +22,3 @@ # github-url-to-object [![Build Status](https://travis-ci.org/zeke/github-url-to-object.png?branch=master)](https://travis-ci.org/zeke/github-url-to-object)

gh('monkey/business')
gh('github:monkey/business')
gh('https://github.com/monkey/business')

@@ -24,0 +25,0 @@ gh('https://github.com/monkey/business.git')

@@ -31,2 +31,31 @@ var mocha = require("mocha")

describe("mediumhand", function(){
it("supports github:user/repo style", function(){
var obj = gh("user/repo#branch")
assert.equal(obj.user, 'user')
assert.equal(obj.repo, 'repo')
})
it("supports github:user/repo#branch style", function(){
var obj = gh("user/repo#branch")
assert.equal(obj.user, 'user')
assert.equal(obj.repo, 'repo')
assert.equal(obj.branch, 'branch')
})
it("defaults to master branch", function(){
var obj = gh("github:user/repo")
assert.equal(obj.user, 'user')
assert.equal(obj.repo, 'repo')
assert.equal(obj.branch, 'master')
})
it("rejects bitbucket", function(){
var obj = gh("bitbucket:user/repo")
assert.equal(obj, null)
})
})
describe("oldschool", function(){

@@ -33,0 +62,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc