Socket
Socket
Sign inDemoInstall

@hutson/parse-repository-url

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hutson/parse-repository-url - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

10

package.json

@@ -31,9 +31,7 @@ {

"scripts": {
"dev": "docker run --rm --user node -v \"$(pwd)\":/app -w /app -it node:6 sh -c \"yarn install; yarn test; bash\"",
"test": "eslint src/ && nyc mocha --opts mocha.opts src/**/*.spec.js"
"test": "semistandard 'src/**/*.js' && nyc mocha --opts mocha.opts src/**/*.spec.js"
},
"version": "3.0.1",
"version": "3.0.2",
"devDependencies": {
"@hutson/conventional-changelog-config": "^2.0.0",
"@hutson/eslint-config": "^3.0.0",
"@hutson/nyc-config": "^2.0.0",

@@ -43,7 +41,7 @@ "chai": "^4.2.0",

"debug": "^4.1.0",
"eslint": "^5.7.0",
"mocha": "^5.2.0",
"npm-publish-git-tag": "^3.0.0",
"nyc": "^13.1.0",
"semantic-release-gitlab": "^7.0.10"
"semantic-release-gitlab": "^7.0.10",
"semistandard": "^13.0.1"
},

@@ -50,0 +48,0 @@ "readme": "ERROR: No README data found!",

8

src/index.js
'use strict';
const {parse} = require(`url`);
const { parse } = require(`url`);

@@ -19,3 +19,3 @@ const URL_PATTERNS = new RegExp(/^\/?:?([/\w-.]+)\/([\w-.]+)\/?$/);

const format = matches => {
return {browse: createBrowseURL(parsedURL, matches), domain: parsedURL.host, project: matches[2] || null, type: getType(parsedURL), user: matches[1] || null};
return { browse: createBrowseURL(parsedURL, matches), domain: parsedURL.host, project: matches[2] || null, type: getType(parsedURL), user: matches[1] || null };
};

@@ -38,3 +38,3 @@

function getType(parsedURL) {
function getType (parsedURL) {
if (typeof parsedURL.host !== `string`) {

@@ -54,3 +54,3 @@ return null;

function createBrowseURL(parsedURL, matches) {
function createBrowseURL (parsedURL, matches) {
const protocol = parsedURL.protocol === `http:` ? `http:` : `https:`;

@@ -57,0 +57,0 @@ const browseURL = `${protocol}//${parsedURL.host}/${matches[1]}/${matches[2]}`;

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