Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github-url-from-username-repo

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-url-from-username-repo - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

11

index.js

@@ -5,3 +5,12 @@ module.exports = getUrl

if (!r) return null
if (/^[\w-]+\/[\w\.-]+(#[a-z0-9]*)?$/.test(r)) {
// Regex taken from https://github.com/npm/npm-package-arg/commit/01dce583c64afae07b66a2a8a6033aeba871c3cd
// Note: This does not fully test the git ref format.
// See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
//
// The only way to do this properly would be to shell out to
// git-check-ref-format, and as this is a fast sync function,
// we don't want to do that. Just let git fail if it turns
// out that the commit-ish is invalid.
// GH usernames cannot start with . or -
if (/^[^@%\/\s\.-][^@%\/\s]*\/[^@\s\/%]+(?:#.*)?$/.test(r)) {
if (forBrowser)

@@ -8,0 +17,0 @@ r = r.replace("#", "/tree/")

2

package.json
{
"name": "github-url-from-username-repo",
"version": "1.0.0",
"version": "1.0.1",
"description": "Create urls from username/repo",

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

@@ -42,3 +42,10 @@ var assert = require("assert")

})
it("can handle branches with slashes", function () {
var url = getUrl(
"component/entejs#some/branch/name")
assert.equal("https://github.com/component/entejs#some/branch/name", url)
})
describe("browser mode", function () {

@@ -45,0 +52,0 @@ it("is able to return urls for branches", function () {

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